import withSession from '../../lib/session' async function loginHandler(req: any, res: any): Promise { 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)