This repository has been archived on 2024-06-14. You can view files and clone it, but cannot push or open issues or pull requests.
icynet-admin/pages/api/logout.ts

17 lines
410 B
TypeScript
Raw Normal View History

2022-08-29 18:09:28 +00:00
import { NextApiRequest, NextApiResponse } from 'next';
import Cookies from 'cookies';
import { COOKIE_KEYS } from '../../lib/constants';
export default async function handler(
req: NextApiRequest,
res: NextApiResponse
) {
const cookies = new Cookies(req, res, { keys: COOKIE_KEYS });
cookies.set('authorization', undefined, {
expires: new Date(0),
signed: true,
});
res.redirect('/');
}