feat(submodules and login redirect): submodules added and login redirect

This commit is contained in:
2025-04-04 22:10:11 -05:00
parent f1abe7b33d
commit 85577b291f
15 changed files with 450 additions and 223 deletions

View File

@@ -0,0 +1,9 @@
import { createFileRoute } from '@tanstack/react-router'
export const Route = createFileRoute('/(logistics)/siloAdjustments/')({
component: RouteComponent,
})
function RouteComponent() {
return <div>Hello "/(logistics)/siloAdjustments/"!</div>
}

View File

@@ -1,4 +1,4 @@
import {createFileRoute, redirect} from "@tanstack/react-router";
import { createFileRoute, redirect } from "@tanstack/react-router";
// src/routes/_authenticated.tsx
export const Route = createFileRoute("/_admin")({
@@ -7,6 +7,12 @@ export const Route = createFileRoute("/_admin")({
if (!auth) {
throw redirect({
to: "/login",
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.pathname + location.search,
},
});
}
},

View File

@@ -1,4 +1,4 @@
import {createFileRoute, redirect} from "@tanstack/react-router";
import { createFileRoute, redirect } from "@tanstack/react-router";
// src/routes/_authenticated.tsx
export const Route = createFileRoute("/_auth")({
@@ -7,6 +7,12 @@ export const Route = createFileRoute("/_auth")({
if (!auth) {
throw redirect({
to: "/login",
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,
},
});
}
},

View File

@@ -1,6 +1,7 @@
import {createFileRoute, redirect} from "@tanstack/react-router";
import { createFileRoute, redirect } from "@tanstack/react-router";
import LoginForm from "@/components/auth/LoginForm";
import { z } from "zod";
export const Route = createFileRoute("/login")({
component: RouteComponent,
@@ -12,6 +13,9 @@ export const Route = createFileRoute("/login")({
});
}
},
validateSearch: z.object({
redirect: z.string().optional(),
}),
});
function RouteComponent() {