@@ -59,10 +63,6 @@ const MeetingsPanel: React.FC = () => {
const startDatemil = startDate.getTime();
const endDatemil = startDatemil + meeting.duration * 60000;
const endDate = new Date(endDatemil);
- const [currentDate, setCurrentDate] = useState
(new Date());
- useEffect(() => {
- setInterval(() => setCurrentDate(new Date()), 1000);
- }, []);
const currentDatemil = currentDate.getTime();
diff --git a/src/components/login/Login.tsx b/src/components/login/Login.tsx
index e286d13..36bfd79 100644
--- a/src/components/login/Login.tsx
+++ b/src/components/login/Login.tsx
@@ -8,10 +8,6 @@ import hsbcLogo from "../../assets/logo-png.png";
import zoomLogo from "../../assets/zoom.png";
import LoginIcon from "@mui/icons-material/Login";
import useAuth from "../../hooks/useAuth";
-import { store } from "../../redux/store";
-import { fetchFavorites } from "../../redux/slices/favoritesSlice";
-import { fetchMeetings } from "../../redux/slices/meetingsAndUserStatusSlice";
-import { fetchUsers } from "../../redux/slices/usersSlice";
import axios from "../../api/axios";
interface LocationState {
@@ -27,7 +23,6 @@ const Login: React.FC = () => {
const [email, setEmail] = useState("");
const [password, setPassword] = useState("");
- const [logedInUser, setLogedInUser] = useState("");
// const [errMsg, setErrMsg] = useState('');
// const userRef = useRef();
@@ -41,16 +36,12 @@ const Login: React.FC = () => {
// setErrMsg('');
// }, [user, pwd])
- store.dispatch(fetchMeetings("1")); // temp fix
- store.dispatch(fetchUsers("1")); // temp fix
- store.dispatch(fetchFavorites("1")); // temp fix
-
const handleLogin = async(e: React.SyntheticEvent) => {
e.preventDefault();
try {
if (email === "" && password === "") {
- setAuth["email"] = email;
+ setAuth["uuid"] = "";
setAuth["isLoggedIn"] = true;
navigate(from, { replace: true });
}
@@ -69,9 +60,8 @@ const Login: React.FC = () => {
console.log(response?.data);
if (logedInUserId != undefined) {
- setAuth["email"] = email;
+ setAuth["uuid"] = logedInUserId;
setAuth["isLoggedIn"] = true;
- // setLogedInUser(logedInUserId);
navigate(from, { replace: true });
}
} catch (error) {
diff --git a/src/context/AuthProvider.tsx b/src/context/AuthProvider.tsx
index 6accd02..793946c 100644
--- a/src/context/AuthProvider.tsx
+++ b/src/context/AuthProvider.tsx
@@ -1,17 +1,17 @@
import { createContext, useState } from "react";
interface loginInfo {
- email: string;
+ uuid: string;
isLoggedIn: boolean;
}
const AuthContext = createContext({
- email: "",
+ uuid: "",
isLoggedIn: false,
});
export const AuthProvider = ({ children }: { children: React.ReactNode }) => {
- const [auth] = useState({ email: "", isLoggedIn: false });
+ const [auth] = useState({ uuid: "", isLoggedIn: false });
return {children};
};
diff --git a/src/hooks/useAuth.tsx b/src/hooks/useAuth.tsx
index af7ffe0..17bf4f8 100644
--- a/src/hooks/useAuth.tsx
+++ b/src/hooks/useAuth.tsx
@@ -2,7 +2,7 @@ import { useContext } from "react";
import AuthContext from "../context/AuthProvider";
interface loginInfo {
- email: string;
+ uuid: string;
isLoggedIn: boolean;
}