import type { RequestHandler } from '@sveltejs/kit';
import { deleteSession, getSession } from '$lib/server/session';

export const POST = (async ({ cookies }) => {
	if (getSession(cookies) == null) {
		return new Response(null, {
			status: 401
		});
	}

	deleteSession(cookies);
	cookies.delete('session');

	return new Response();
}) satisfies RequestHandler;
