mirror of
https://github.com/jcreek/SvelteKitSaasBoilerplate.git
synced 2026-07-13 19:13:48 +00:00
feat(#37): Enable tracking credits usage with proof of concept test page
This commit is contained in:
@@ -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 };
|
||||
};
|
||||
Reference in New Issue
Block a user