diff --git a/frontend/src/components/Pages/About.jsx b/frontend/src/components/Pages/About.jsx index f4ab679b..f834b2aa 100644 --- a/frontend/src/components/Pages/About.jsx +++ b/frontend/src/components/Pages/About.jsx @@ -1,8 +1,7 @@ - -import bgpic from "../../assets/img/abt1.jpg"; +'use client'; +import bgpic from '../../assets/img/abt1.jpg'; import React, { useEffect } from 'react'; - export default function About() { useEffect(() => { window.scrollTo(0, 0); diff --git a/frontend/src/components/Pages/Login.jsx b/frontend/src/components/Pages/Login.jsx index 19f47c20..7c760afa 100644 --- a/frontend/src/components/Pages/Login.jsx +++ b/frontend/src/components/Pages/Login.jsx @@ -13,13 +13,14 @@ const Login = () => { password: '', }); const [hidden, setHidden] = useState(true); + const [isLoading, setIsLoading] = useState(false); + const [error, setError] = useState(null); + + const navigate = useNavigate(); const handleChange = (e) => { setData({ ...data, [e.target.name]: e.target.value }); }; - const navigate = useNavigate(); // Correctly initialize useNavigate - const [isLoading, setIsLoading] = useState(false); - const [error, setError] = useState(null); const handleSubmit = async (e) => { e.preventDefault(); @@ -37,11 +38,7 @@ const Login = () => { if (!response.ok) { throw new Error(result.message || 'Login failed'); } - // Handle successful login (e.g., store token, redirect) - Cookies.set('authToken', result.token, { - expire: '1h', - secure: true, - }); + Cookies.set('authToken', result.token, { expire: '1h', secure: true }); message.success('Login successful'); navigate('/'); } catch (err) { @@ -56,37 +53,44 @@ const Login = () => { }, []); return ( -