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

12 lines
307 B
TypeScript

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