feat(#37): Enable tracking credits usage with proof of concept test page

This commit is contained in:
Josh Creek
2024-10-08 19:39:28 +01:00
parent fcbd69373c
commit db3425ec96
6 changed files with 348 additions and 1 deletions
@@ -0,0 +1,18 @@
import { redirect } from '@sveltejs/kit';
import type { PageServerLoad } from './$types';
export const load: PageServerLoad = async ({ locals: { supabase, safeGetSession } }) => {
const { session } = await safeGetSession();
if (!session) {
redirect(303, '/');
}
const { data: user } = await supabase
.from('users')
.select(`name, id`)
.eq('id', session.user.id)
.single();
return { session, user };
};