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
2022-08-29 21:09:28 +03:00

17 lines
410 B
TypeScript

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('/');
}