feat(lst): tan stack routes added with protected routes

This commit is contained in:
2025-02-19 20:11:40 -06:00
parent 83f6fbf760
commit 5f8943492e
23 changed files with 608 additions and 74 deletions

View File

@@ -0,0 +1,38 @@
import {createFileRoute, useRouter} from "@tanstack/react-router";
import {isAuthenticated, signIn, signOut} from "../utils/auth";
import {Button} from "../components/ui/button";
export const Route = createFileRoute("/login")({
component: RouteComponent,
});
function RouteComponent() {
const router = useRouter();
return (
<div>
<h2>Ligin</h2>
{isAuthenticated() ? (
<>
<p>Hello User!</p>
<Button
onClick={async () => {
signOut();
router.invalidate();
}}
>
signOut
</Button>
</>
) : (
<Button
onClick={async () => {
signIn();
router.invalidate();
}}
>
Sign in
</Button>
)}
</div>
);
}