2
0

feat(api): Add routes for subscribing webhook

This commit is contained in:
Baptiste Arnaud
2022-02-21 11:46:56 +01:00
parent 5a80774ff5
commit 68ae69f366
21 changed files with 470 additions and 175 deletions

View File

@ -0,0 +1,16 @@
import { withSentry } from '@sentry/nextjs'
import { NextApiRequest, NextApiResponse } from 'next'
import { authenticateUser } from 'services/api/utils'
import { isNotDefined, methodNotAllowed } from 'utils'
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
if (req.method === 'GET') {
const user = await authenticateUser(req)
if (isNotDefined(user))
return res.status(404).send({ message: 'User not found' })
return res.send({ id: user.id })
}
return methodNotAllowed(res)
}
export default withSentry(handler)