mirror of
https://github.com/kennethnym/aris.git
synced 2026-05-07 00:51:19 +01:00
Compare commits
1 Commits
21b7d299a6
...
fix/dashbo
| Author | SHA1 | Date | |
|---|---|---|---|
|
3a4e393e7a
|
@@ -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<ReturnType<typeof getSession>> | null = null
|
||||
try {
|
||||
session = await context.queryClient.ensureQueryData({
|
||||
queryKey: ["session"],
|
||||
queryFn: getSession,
|
||||
})
|
||||
} catch {
|
||||
throw redirect({ to: "/login" })
|
||||
}
|
||||
if (!session?.user) {
|
||||
throw redirect({ to: "/login" })
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user