mirror of
https://github.com/ramvignesh-b/pi-ku.git
synced 2026-05-04 08:56:52 +00:00
feat: implement authentication flow with JWT refresh logic, Login page, and user session management
This commit is contained in:
@@ -1,15 +1,21 @@
|
||||
import Logo from "../components/Logo";
|
||||
import { useEffect } from "react";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import { useAuth } from "../store/useAuth";
|
||||
|
||||
export default function Drawer() {
|
||||
const { user, isAuthenticated } = useAuth();
|
||||
const navigate = useNavigate();
|
||||
|
||||
// Redirect to login if not authenticated
|
||||
useEffect(() => {
|
||||
if (!isAuthenticated) {
|
||||
navigate("/login");
|
||||
}
|
||||
}, [isAuthenticated, navigate]);
|
||||
|
||||
if (!user) return null;
|
||||
|
||||
export default function Login() {
|
||||
return (
|
||||
<div className="glass-card w-full max-w-sm p-8 text-center fade-zoom">
|
||||
<h2 className="font-display text-2xl font-bold text-primary">
|
||||
Login to <Logo />
|
||||
</h2>
|
||||
<div className="divider"></div>
|
||||
<button type="button" disabled className="btn btn-primary w-full">
|
||||
Sign In
|
||||
</button>
|
||||
</div>
|
||||
<div className="glass-card w-full max-w-sm p-8 text-center fade-zoom"></div>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user