chore: auth context

This commit is contained in:
Aslam H
2024-10-08 16:01:36 +07:00
parent 7c31f9b417
commit 94be662fc2
3 changed files with 8 additions and 10 deletions

View File

@@ -1,8 +1,7 @@
import { createFileRoute, Outlet, redirect } from "@tanstack/react-router"
export const Route = createFileRoute("/_layout/_pages/_protected")({
beforeLoad: ({ context, location, cause }) => {
if (cause === "stay") return
beforeLoad: async ({ context, location, cause }) => {
if (!context?.auth?.userId) {
throw redirect({
to: "/sign-in/$",