diff --git a/src/pages/Login.tsx b/src/pages/Login.tsx
index b8228799..ba0f377e 100644
--- a/src/pages/Login.tsx
+++ b/src/pages/Login.tsx
@@ -1,143 +1,138 @@
-import axios from "axios";
-import { useState, useContext, useEffect, FormEvent } from "react";
-import { useNavigate, Link } from "react-router-dom";
-import { AuthContext } from "../context/auth";
-import { Box, Typography, TextField, Button, CircularProgress, Grid } from "@mui/material";
-import { useGlobalInfoStore } from "../context/globalInfo";
+import axios from "axios";
+import { useState, useContext, useEffect, FormEvent } from "react";
+import { useNavigate, Link } from "react-router-dom";
+import { AuthContext } from "../context/auth";
+import { Box, Typography, TextField, Button, CircularProgress, Grid } from "@mui/material";
+import { useGlobalInfoStore } from "../context/globalInfo";
import { apiUrl } from "../apiConfig";
import { useTranslation } from 'react-i18next';
-import i18n from '../i18n';
+import i18n from '../i18n';
const Login = () => {
- const { t } = useTranslation();
- // just don't remove these logs - god knows why it's not working without them
- console.log(i18n)
- console.log(t)
- const [form, setForm] = useState({
- email: "",
- password: "",
- });
- const [loading, setLoading] = useState(false);
- const { notify } = useGlobalInfoStore();
- const { email, password } = form;
+ const { t } = useTranslation();
+ // just don't remove these logs - god knows why it's not working without them
+ console.log(i18n)
+ console.log(t)
+ 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(`${apiUrl}/auth/login`, {
- email,
- password,
- });
- dispatch({ type: "LOGIN", payload: data });
- notify("success", t('login.welcome_notification')); // Translated notification
- window.localStorage.setItem("user", JSON.stringify(data));
- navigate("/");
- } catch (err) {
- notify("error", t('login.error_notification')); // Translated error
- setLoading(false);
- }
- };
+ const submitForm = async (e: any) => {
+ e.preventDefault();
+ setLoading(true);
+ try {
+ const { data } = await axios.post(`${apiUrl}/auth/login`, {
+ email,
+ password,
+ });
+ dispatch({ type: "LOGIN", payload: data });
+ notify("success", t('login.welcome_notification'));
+ window.localStorage.setItem("user", JSON.stringify(data));
+ navigate("/");
+ } catch (err) {
+ notify("error", t('login.error_notification'));
+ setLoading(false);
+ }
+ };
- // Language switcher function
-
-
- return (
-
- {/* Language Switcher Buttons */}
-
-
-
-
- {t('login.title')}
-
-
-
-
-
- {t('login.register_prompt')}{" "}
-
- {t('login.register_link')}
-
-
-
-
- );
+ return (
+
+
+
+
+ {t('login.title')}
+
+
+
+
+
+ {t('login.register_prompt')}{" "}
+
+ {t('login.register_link')}
+
+
+
+
+ );
};
export default Login;
\ No newline at end of file