Skip to content

Commit d3b3266

Browse files
committed
dd
1 parent 19697d1 commit d3b3266

File tree

3 files changed

+23
-22
lines changed

3 files changed

+23
-22
lines changed

src/App.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, { useEffect, useState } from 'react';
2-
import { Routes, Route, Navigate } from 'react-router-dom';
2+
import { Routes, Route, Navigate, useLocation } from 'react-router-dom';
33
import { useAppSelector } from './reducers/hooks';
44
import Login from './components/Login/Login';
55
import SignUp from './components/SignUp/SignUp';
@@ -23,7 +23,7 @@ const App = () => {
2323
// eslint-disable-next-line @typescript-eslint/no-explicit-any
2424
const { updateSession } = useSurvey();
2525
const { checkCookie } = useHelper();
26-
26+
const location = useLocation();
2727
const [loading, setLoading] = useState(true);
2828
const [session, setSession] = useState<boolean | undefined>(undefined);
2929

@@ -46,7 +46,7 @@ const App = () => {
4646
}
4747
};
4848
checkLogin();
49-
}, [checkCookie, updateSession]);
49+
}, [location.pathname, checkCookie, updateSession]);
5050

5151
if (loading) {
5252
return <div>Loading...</div>;

src/components/Login/Login.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ const Login = (): JSX.Element => {
7272
)
7373
);
7474
// Navigate to root route
75+
console.log(data);
7576
navigate('/');
7677
} catch (err) {
7778
// Alert user upon wrong username or password entry using an alert.

src/components/SharedLayout/SharedLayout.tsx

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ function SharedLayout(): JSX.Element {
129129
writeToDb();
130130
networkContainers();
131131
getAllDockerVolumes();
132-
setAdminToken();
132+
// setAdminToken();
133133
// eslint-disable-next-line react-hooks/exhaustive-deps
134134
}, []);
135135

@@ -155,25 +155,25 @@ function SharedLayout(): JSX.Element {
155155
}, []);
156156

157157
// Pertains to sysAdmin only
158-
const setAdminToken = async (): Promise<void> => {
159-
try {
160-
const response = await fetch('/api/admin', {
161-
method: 'POST',
162-
headers: {
163-
'Content-Type': 'application/json',
164-
},
165-
body: JSON.stringify({
166-
token: userData.token,
167-
username: userData.username,
168-
}),
169-
});
170-
const parsedData = await response.json();
158+
// const setAdminToken = async (): Promise<void> => {
159+
// try {
160+
// const response = await fetch('/api/admin', {
161+
// method: 'POST',
162+
// headers: {
163+
// 'Content-Type': 'application/json',
164+
// },
165+
// body: JSON.stringify({
166+
// token: userData.token,
167+
// username: userData.username,
168+
// }),
169+
// });
170+
// const parsedData = await response.json();
171171

172-
updateUser(parsedData);
173-
} catch (e) {
174-
console.log(e);
175-
}
176-
};
172+
// updateUser(parsedData);
173+
// } catch (e) {
174+
// console.log(e);
175+
// }
176+
// };
177177

178178
return (
179179
<div className={styles.wrapper}>

0 commit comments

Comments
 (0)