import { redirect } from '@sveltejs/kit';
import type { RequestHandler } from './$types';

export const POST: RequestHandler = async ({ cookies }) => {
	// Eliminar todas las cookies de autenticación
	cookies.delete('access_token', { path: '/' });
	cookies.delete('refresh_token', { path: '/' });

	// Eliminar la cookie de la compañía activa
	cookies.delete('active_company_id', { path: '/' });

	// Redirigir al login
	throw redirect(303, '/login');
};
