29 lines
865 B
TypeScript
29 lines
865 B
TypeScript
import DmPage from "@/components/logistics/dm/dmPage";
|
|
import { createFileRoute, redirect } from "@tanstack/react-router";
|
|
|
|
export const Route = createFileRoute("/(logistics)/dm/")({
|
|
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,
|
|
},
|
|
});
|
|
}
|
|
},
|
|
});
|
|
|
|
function RouteComponent() {
|
|
return (
|
|
<div>
|
|
<DmPage />
|
|
</div>
|
|
);
|
|
}
|