mirror of
https://github.com/taogaetz/chefbible.git
synced 2025-12-06 11:47:24 -05:00
32 lines
1.1 KiB
TypeScript
32 lines
1.1 KiB
TypeScript
import type { RequestHandler } from './$types';
|
|
import { redirect } from '@sveltejs/kit';
|
|
import { dev } from '$app/environment';
|
|
|
|
export const POST: RequestHandler = async ({ cookies }) => {
|
|
// Clear the authentication cookie using the new API
|
|
cookies.set('chef_bible_auth', '', {
|
|
path: '/',
|
|
httpOnly: true,
|
|
sameSite: 'lax', // Changed from 'strict' to 'lax' for mobile Safari compatibility
|
|
secure: !dev, // Secure in production, not secure in development
|
|
maxAge: 0 // Expire immediately
|
|
});
|
|
|
|
// Redirect to home page
|
|
throw redirect(302, '/');
|
|
};
|
|
|
|
export const GET: RequestHandler = async ({ cookies }) => {
|
|
// Clear the authentication cookie using the new API
|
|
cookies.set('chef_bible_auth', '', {
|
|
path: '/',
|
|
httpOnly: true,
|
|
sameSite: 'lax', // Changed from 'strict' to 'lax' for mobile Safari compatibility
|
|
secure: !dev, // Secure in production, not secure in development
|
|
maxAge: 0 // Expire immediately
|
|
});
|
|
|
|
// Redirect to home page
|
|
throw redirect(302, '/');
|
|
};
|