More signout fixes

This commit is contained in:
Roman Krček
2025-06-23 14:18:05 +02:00
parent fe8789af87
commit 1760448f73
3 changed files with 11 additions and 16 deletions

View File

@@ -1,7 +0,0 @@
import { redirect } from '@sveltejs/kit';
import type { PageServerLoad } from './$types';
export const load: PageServerLoad = async ({ locals }) => {
await locals.supabase.auth.signOut();
throw redirect(303, '/');
};

View File

@@ -1,9 +0,0 @@
<script lang="ts">
import { onMount } from 'svelte';
onMount(() => {
localStorage.clear();
});
</script>
<p>Signing out...</p>

View File

@@ -0,0 +1,11 @@
import type { RequestHandler } from './$types';
export const GET: RequestHandler = async ({ locals}) => {
await locals.supabase.auth.signOut();
const html = `
<script>
localStorage.clear();
location.href = '/';
</script>`;
return new Response(html, { headers: { 'Content-Type': 'text/html' } });
};