diff --git a/src/pages/Login.tsx b/src/pages/Login.tsx
index 7ea8c42b..cfdb16f2 100644
--- a/src/pages/Login.tsx
+++ b/src/pages/Login.tsx
@@ -2,124 +2,124 @@ import axios from 'axios';
import { useState, useContext, useEffect } from 'react';
import { useNavigate, Link } from 'react-router-dom';
import { AuthContext } from '../context/auth';
-import {
- Box,
- Typography,
- TextField,
- Button,
- CircularProgress,
+import {
+ Box,
+ Typography,
+ TextField,
+ Button,
+ CircularProgress,
} from '@mui/material';
import { useGlobalInfoStore } from "../context/globalInfo";
const SignIn = () => {
- const [form, setForm] = useState({
- email: '',
- password: '',
- });
- const [loading, setLoading] = useState(false);
- const { notify } = useGlobalInfoStore();
- const { email, password } = form;
+ const [form, setForm] = useState({
+ email: '',
+ password: '',
+ });
+ const [loading, setLoading] = useState(false);
+ const { notify } = useGlobalInfoStore();
+ const { email, password } = form;
- const { state, dispatch } = useContext(AuthContext);
- const { user } = state;
+ const { state, dispatch } = useContext(AuthContext);
+ const { user } = state;
- const navigate = useNavigate();
+ const navigate = useNavigate();
- useEffect(() => {
- if (user) {
- navigate('/');
- }
- }, [user, navigate]);
+ useEffect(() => {
+ if (user) {
+ navigate('/');
+ }
+ }, [user, navigate]);
- const handleChange = (e: any) => {
- const { name, value } = e.target;
- setForm({ ...form, [name]: value });
- };
+ const handleChange = (e: any) => {
+ const { name, value } = e.target;
+ setForm({ ...form, [name]: value });
+ };
- const submitForm = async (e: any) => {
- e.preventDefault();
- setLoading(true);
- try {
- const { data } = await axios.post(`/api/login`, { email, password });
- dispatch({ type: 'LOGIN', payload: data });
- notify('success', 'Welcome to Maxun!');
- window.localStorage.setItem('user', JSON.stringify(data));
- navigate('/');
- } catch (err: any) {
- notify('error', err.response.data || 'Login Failed. Please try again.');
- setLoading(false);
- }
- };
+ const submitForm = async (e: any) => {
+ e.preventDefault();
+ setLoading(true);
+ try {
+ const { data } = await axios.post(`/api/login`, { email, password });
+ dispatch({ type: 'LOGIN', payload: data });
+ notify('success', 'Welcome to Maxun!');
+ window.localStorage.setItem('user', JSON.stringify(data));
+ navigate('/');
+ } catch (err: any) {
+ notify('error', err.response.data || 'Login Failed. Please try again.');
+ setLoading(false);
+ }
+ };
- return (
-
-
- Login
-
-
-
- OR
-
-
- {/* Login Form */}
-
-
-
-
-
+
+ Login
+
- {/* Redirect to Register */}
-
- Don’t have an account?{' '}
-
- Register
-
-
-
-
- );
+
+ OR
+
+
+ {/* Login Form */}
+
+
+
+
+
+
+ {/* Redirect to Register */}
+
+ Don’t have an account?{' '}
+
+ Register
+
+
+
+
+ );
};
export default SignIn;