test(silos): more base line silo data to be implemented
This commit is contained in:
31
frontend/src/routes/(logistics)/siloAdjustments/$hist.tsx
Normal file
31
frontend/src/routes/(logistics)/siloAdjustments/$hist.tsx
Normal file
@@ -0,0 +1,31 @@
|
||||
import { createFileRoute, redirect } from "@tanstack/react-router";
|
||||
|
||||
export const Route = createFileRoute("/(logistics)/siloAdjustments/$hist")({
|
||||
component: RouteComponent,
|
||||
beforeLoad: async () => {
|
||||
const auth = localStorage.getItem("auth_token");
|
||||
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,
|
||||
},
|
||||
});
|
||||
}
|
||||
},
|
||||
// In a loader
|
||||
loader: ({ params }) => params.hist,
|
||||
// Or in a component
|
||||
});
|
||||
|
||||
function RouteComponent() {
|
||||
return (
|
||||
<div>
|
||||
Hello "/(logistics)/siloAdjustments/$hist"! where the historical
|
||||
data will be shown in a table alone with a graph
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user