add additional loggin

This commit is contained in:
Nate Kelley 2025-09-10 16:16:44 -06:00
parent 430ae8d35a
commit 48c65db3c9
No known key found for this signature in database
GPG Key ID: FD90372AB8D98B4F
2 changed files with 18 additions and 9 deletions

View File

@ -14,7 +14,11 @@ export const getSupabaseSession = async () => {
: await supabase.auth.getSession(); //10 - 15ms locally, maybe consider getting it from the cookie instead. console the supabase object it had it there.
if ((!sessionData?.session || sessionError) && !isServer) {
throw new Error('No session data found');
return {
accessToken: '',
isExpired: true,
expiresAt: 0,
};
}
const isExpired = isTokenExpired(sessionData.session?.expires_at);

View File

@ -16,6 +16,7 @@ export const Route = createFileRoute('/app')({
ssr: true,
beforeLoad: async () => {
console.log('beforeLoad app route');
try {
const { isExpired, accessToken = '' } = await getSupabaseSession();
console.log('beforeLoad app route done');
@ -27,6 +28,10 @@ export const Route = createFileRoute('/app')({
return {
accessToken,
};
} catch (error) {
console.error('Error in app route beforeLoad:', error);
throw redirect({ to: '/auth/login', replace: true });
}
},
loader: async ({ context }) => {
const { queryClient, accessToken } = context;