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,29 @@
import {createFileRoute} from "@tanstack/react-router";
import LoginForm from "../components/auth/LoginForm";
import {Button} from "../components/ui/button";
import {useLogout} from "../lib/hooks/useLogout";
import {useSession} from "../lib/hooks/useSession";
export const Route = createFileRoute("/")({
component: Index,
});
function Index() {
const {session} = useSession();
const logout = useLogout();
return (
<div className="p-2">
<h3>Welcome Home!</h3>
<br></br>
<p>
{session ? (
<>
<Button onClick={() => logout()}>Logout</Button>{" "}
</>
) : (
<LoginForm />
)}
</p>
</div>
);
}