// dashboard.tsx
export const Route = createFileRoute("/search/dashboard")({
component: Index,
beforeLoad: async ({ location }) => {
const isAuth = await isAuthenticated();
if (!isAuth?.tokens) {
throw redirect({
to: "/sign-in",
search: {
// Use the current location to power a redirect after login
// (Do not use `router.state.resolvedLocation` as it can
// potentially lag behind the actual current location)
redirect: location.href,
},
});
}
},
});
// dashboard.tsx
export const Route = createFileRoute("/search/dashboard")({
component: Index,
beforeLoad: async ({ location }) => {
const isAuth = await isAuthenticated();
if (!isAuth?.tokens) {
throw redirect({
to: "/sign-in",
search: {
// Use the current location to power a redirect after login
// (Do not use `router.state.resolvedLocation` as it can
// potentially lag behind the actual current location)
redirect: location.href,
},
});
}
},
});