import { NextApiRequest, NextApiResponse } from 'next'; import Cookies from 'cookies'; import { COOKIE_KEYS } from '../../lib/constants'; const inProd = process.env.NODE_ENV === 'production'; export default async function handler( req: NextApiRequest, res: NextApiResponse ) { const cookies = new Cookies(req, res, { keys: COOKIE_KEYS, secure: inProd }); cookies.set('authorization', undefined, { expires: new Date(0), signed: true, secure: inProd, }); res.redirect('/'); }