diff --git a/apps/admin-dashboard/src/routes/_dashboard.tsx b/apps/admin-dashboard/src/routes/_dashboard.tsx index e097b96..bfbf00b 100644 --- a/apps/admin-dashboard/src/routes/_dashboard.tsx +++ b/apps/admin-dashboard/src/routes/_dashboard.tsx @@ -47,10 +47,15 @@ export const Route = createRoute({ getParentRoute: () => rootRoute, id: "dashboard", beforeLoad: async ({ context }) => { - const session = await context.queryClient.ensureQueryData({ - queryKey: ["session"], - queryFn: getSession, - }) + let session: Awaited> | null = null + try { + session = await context.queryClient.ensureQueryData({ + queryKey: ["session"], + queryFn: getSession, + }) + } catch { + throw redirect({ to: "/login" }) + } if (!session?.user) { throw redirect({ to: "/login" }) }