refactor(v1 cleanup): added in removal of localstoage items from v1

This commit is contained in:
2025-04-21 07:46:24 -05:00
parent b42b8a4c83
commit f44e5a87e7
5 changed files with 57 additions and 7 deletions

View File

@@ -0,0 +1,23 @@
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>Hello "/(logistics)/dm/"!</div>;
}