mirror of
https://github.com/LukeHagar/Sveltey.git
synced 2025-12-06 04:21:38 +00:00
adding logs
This commit is contained in:
@@ -32,10 +32,12 @@ const supabase: Handle = async ({ event, resolve }) => {
|
|||||||
* JWT before returning the session.
|
* JWT before returning the session.
|
||||||
*/
|
*/
|
||||||
event.locals.safeGetSession = async () => {
|
event.locals.safeGetSession = async () => {
|
||||||
|
console.log('running safeGetSession');
|
||||||
const {
|
const {
|
||||||
data: { session }
|
data: { session }
|
||||||
} = await event.locals.supabase.auth.getSession();
|
} = await event.locals.supabase.auth.getSession();
|
||||||
if (!session) {
|
if (!session) {
|
||||||
|
console.log('no session, returning null');
|
||||||
return { session: null, user: null };
|
return { session: null, user: null };
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -44,10 +46,12 @@ const supabase: Handle = async ({ event, resolve }) => {
|
|||||||
error
|
error
|
||||||
} = await event.locals.supabase.auth.getUser();
|
} = await event.locals.supabase.auth.getUser();
|
||||||
if (error) {
|
if (error) {
|
||||||
|
console.log('error getting user, returning null');
|
||||||
// JWT validation has failed
|
// JWT validation has failed
|
||||||
return { session: null, user: null };
|
return { session: null, user: null };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log('returning session and user');
|
||||||
return { session, user };
|
return { session, user };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user