mirror of
https://github.com/koreanbots/core.git
synced 2025-12-17 06:40:24 +00:00
feat: added logout
This commit is contained in:
parent
2a98be6bbb
commit
31661337fd
14
pages/api/auth/discord/logout.ts
Normal file
14
pages/api/auth/discord/logout.ts
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
import { NextApiRequest, NextApiResponse } from 'next'
|
||||||
|
import nc from 'next-connect'
|
||||||
|
import { serialize } from 'cookie'
|
||||||
|
|
||||||
|
|
||||||
|
const Logout = nc<NextApiRequest, NextApiResponse>()
|
||||||
|
.get(async(req, res) => {
|
||||||
|
res.setHeader('set-cookie', serialize('token', '', {
|
||||||
|
maxAge: -1,
|
||||||
|
path: '/'
|
||||||
|
}))
|
||||||
|
res.redirect(301, '/')
|
||||||
|
})
|
||||||
|
export default Logout
|
||||||
Loading…
x
Reference in New Issue
Block a user