first commit
This commit is contained in:
18
app/routes/home.tsx
Normal file
18
app/routes/home.tsx
Normal file
@@ -0,0 +1,18 @@
|
||||
import { useEffect } from "react";
|
||||
import { useNavigate } from "react-router";
|
||||
import { api } from "~/api/client";
|
||||
|
||||
export default function Home() {
|
||||
const navigate = useNavigate();
|
||||
|
||||
useEffect(() => {
|
||||
// Redirect to dashboard if authenticated, otherwise to login
|
||||
if (api.isAuthenticated()) {
|
||||
navigate("/dashboard");
|
||||
} else {
|
||||
navigate("/login");
|
||||
}
|
||||
}, [navigate]);
|
||||
|
||||
return null;
|
||||
}
|
||||
Reference in New Issue
Block a user