mirror of
https://github.com/tomru/pfadi-bussle.git
synced 2026-03-03 06:27:11 +01:00
17 lines
412 B
TypeScript
17 lines
412 B
TypeScript
import withSession from '../../lib/session'
|
|
|
|
async function loginHandler(req: any, res: any): Promise<void> {
|
|
const { method } = req
|
|
|
|
switch (method) {
|
|
case 'POST':
|
|
req.session.destroy()
|
|
res.json({ message: 'Logged out' })
|
|
break
|
|
default:
|
|
res.setHeader('Allow', ['POST'])
|
|
res.status(405).end(`Method ${method} Not Allowed`)
|
|
}
|
|
}
|
|
export default withSession(loginHandler)
|