Skip to content

Commit

Permalink
Chore: enable console logs to see diagnostics
Browse files Browse the repository at this point in the history
  • Loading branch information
emielvanseveren committed Jun 28, 2024
1 parent 4100618 commit 3e6c323
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/web-main/src/hooks/useAuth.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function getLocalSession() {
}

const expirableSession: ExpirableSession = JSON.parse(expirableSessionString);
if (DateTime.fromISO(expirableSession.expiresAt ?? DateTime.now().toISO()).diffNow().seconds < 0) {
if (DateTime.fromISO(expirableSession.expiresAt).diffNow().seconds < 0) {
return null;
}
return expirableSession.session;
Expand Down
2 changes: 2 additions & 0 deletions packages/web-main/src/routes/_auth.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ import { SessionContext } from 'hooks/useSession';
export const Route = createFileRoute('/_auth')({
beforeLoad: async ({ context }) => {
const session = await context.auth.getSession();
console.log('session:', session);
if (!session) {
console.log('redirecting to login');
const redirectPath = location.pathname === '/login' ? '/' : location.pathname;
throw redirect({ to: '/login', search: { redirect: redirectPath } });
}
Expand Down

0 comments on commit 3e6c323

Please sign in to comment.