login page navigation fix

This commit is contained in:
Yared Yemane 2026-02-27 04:42:34 -08:00
parent 6f9323de27
commit f7ed26231e
2 changed files with 6 additions and 2 deletions

1
.env
View File

@ -1,3 +1,2 @@
VITE_API_BASE_URL=http://localhost:8080/api/v1 VITE_API_BASE_URL=http://localhost:8080/api/v1
VITE_GOOGLE_CLIENT_ID=google_client_id VITE_GOOGLE_CLIENT_ID=google_client_id
VERSION=1.0.0

View File

@ -1,5 +1,5 @@
import { useState, useEffect, useRef, useCallback } from "react"; import { useState, useEffect, useRef, useCallback } from "react";
import { Link, useNavigate } from "react-router-dom"; import { Link, Navigate, useNavigate } from "react-router-dom";
import { Eye, EyeOff } from "lucide-react"; import { Eye, EyeOff } from "lucide-react";
import { BrandLogo } from "../../components/brand/BrandLogo"; import { BrandLogo } from "../../components/brand/BrandLogo";
@ -64,6 +64,11 @@ function GoogleIcon({ className }: { className?: string }) {
export function LoginPage() { export function LoginPage() {
const navigate = useNavigate(); const navigate = useNavigate();
const token = localStorage.getItem("access_token");
if (token) {
return <Navigate to="/dashboard" replace />;
}
const [showPassword, setShowPassword] = useState(false); const [showPassword, setShowPassword] = useState(false);
const [email, setEmail] = useState(""); const [email, setEmail] = useState("");
const [password, setPassword] = useState(""); const [password, setPassword] = useState("");