mirror of
https://github.com/MetaFam/TheGame.git
synced 2026-01-13 16:37:58 -05:00
29 lines
599 B
TypeScript
29 lines
599 B
TypeScript
import {
|
|
NextApiRequest as NextAPIRequest,
|
|
NextApiResponse as NextAPIResponse,
|
|
} from 'next';
|
|
|
|
import { getSession } from '#lib/ironSession';
|
|
|
|
const handler = async (
|
|
req: NextAPIRequest,
|
|
res: NextAPIResponse,
|
|
): Promise<void> => {
|
|
const { method } = req;
|
|
switch (method) {
|
|
case 'GET': {
|
|
const session = await getSession(req, res);
|
|
session.destroy();
|
|
res.send({ ok: true });
|
|
break;
|
|
}
|
|
default: {
|
|
res.setHeader('Allow', ['GET']);
|
|
res.status(405).end(`Method ${method} Not Allowed`);
|
|
}
|
|
}
|
|
return undefined;
|
|
};
|
|
|
|
export default handler;
|