Skip to content

Commit 7214d1c

Browse files
committed
move to function method
1 parent 3cb75e3 commit 7214d1c

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

src/middlewares/base-handler.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,6 @@ export function createBaseHandler() {
5858

5959
// Add session to request
6060
baseHandler.use(async (req, res, next) => {
61-
if (req.method === 'OPTIONS') {
62-
res.status(200).end()
63-
return
64-
}
65-
6661
/** Handle authorization using either Bearer token auth or
6762
* using the next-auth session
6863
*/

src/pages/api/[[...slug]].js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ handler.get('api/', (_, res) => {
1414
res.status(200).json({ version: packageJson.version })
1515
})
1616

17+
handler.options('api/*', (_, res) => {
18+
res.status(200).end()
19+
})
20+
1721
manageRouter(handler)
1822

1923
export default handler

0 commit comments

Comments
 (0)