habits.andr33v.ru/server/api/auth/logout.post.ts

12 lines
262 B
TypeScript

import { useSession } from 'h3';
export default defineEventHandler(async (event) => {
const session = await useSession(event, {
password: process.env.SESSION_PASSWORD,
});
await session.clear();
return { message: 'Logged out successfully.' };
});