added and fixed minor details
This commit is contained in:
@@ -1,9 +1,21 @@
|
||||
import { createFileRoute } from '@tanstack/react-router'
|
||||
import { isAuthenticated } from "../utils/auth";
|
||||
import { createFileRoute, redirect } from "@tanstack/react-router";
|
||||
|
||||
export const Route = createFileRoute('/')({
|
||||
export const Route = createFileRoute("/")({
|
||||
beforeLoad: async () => {
|
||||
if (!(await isAuthenticated())) {
|
||||
throw redirect({
|
||||
to: "/login",
|
||||
});
|
||||
} else {
|
||||
throw redirect({
|
||||
to: "/app/inventory",
|
||||
});
|
||||
}
|
||||
},
|
||||
component: RouteComponent,
|
||||
})
|
||||
});
|
||||
|
||||
function RouteComponent() {
|
||||
return <div>Index "/"!</div>
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user