import {NextApiRequest, NextApiResponse} from "next";
import {sessionOptions} from "@/lib/session";
import {withIronSessionApiRoute} from "iron-session/next";

export default withIronSessionApiRoute(logout, sessionOptions);

async function logout(req: NextApiRequest, res: NextApiResponse) {
	req.session.destroy();
	res.status(200).json(undefined);
}
