File tree Expand file tree Collapse file tree 3 files changed +23
-22
lines changed Expand file tree Collapse file tree 3 files changed +23
-22
lines changed Original file line number Diff line number Diff line change 1
1
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' ;
3
3
import { useAppSelector } from './reducers/hooks' ;
4
4
import Login from './components/Login/Login' ;
5
5
import SignUp from './components/SignUp/SignUp' ;
@@ -23,7 +23,7 @@ const App = () => {
23
23
// eslint-disable-next-line @typescript-eslint/no-explicit-any
24
24
const { updateSession } = useSurvey ( ) ;
25
25
const { checkCookie } = useHelper ( ) ;
26
-
26
+ const location = useLocation ( ) ;
27
27
const [ loading , setLoading ] = useState ( true ) ;
28
28
const [ session , setSession ] = useState < boolean | undefined > ( undefined ) ;
29
29
@@ -46,7 +46,7 @@ const App = () => {
46
46
}
47
47
} ;
48
48
checkLogin ( ) ;
49
- } , [ checkCookie , updateSession ] ) ;
49
+ } , [ location . pathname , checkCookie , updateSession ] ) ;
50
50
51
51
if ( loading ) {
52
52
return < div > Loading...</ div > ;
Original file line number Diff line number Diff line change @@ -72,6 +72,7 @@ const Login = (): JSX.Element => {
72
72
)
73
73
) ;
74
74
// Navigate to root route
75
+ console . log ( data ) ;
75
76
navigate ( '/' ) ;
76
77
} catch ( err ) {
77
78
// Alert user upon wrong username or password entry using an alert.
Original file line number Diff line number Diff line change @@ -129,7 +129,7 @@ function SharedLayout(): JSX.Element {
129
129
writeToDb ( ) ;
130
130
networkContainers ( ) ;
131
131
getAllDockerVolumes ( ) ;
132
- setAdminToken ( ) ;
132
+ // setAdminToken();
133
133
// eslint-disable-next-line react-hooks/exhaustive-deps
134
134
} , [ ] ) ;
135
135
@@ -155,25 +155,25 @@ function SharedLayout(): JSX.Element {
155
155
} , [ ] ) ;
156
156
157
157
// 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();
171
171
172
- updateUser ( parsedData ) ;
173
- } catch ( e ) {
174
- console . log ( e ) ;
175
- }
176
- } ;
172
+ // updateUser(parsedData);
173
+ // } catch (e) {
174
+ // console.log(e);
175
+ // }
176
+ // };
177
177
178
178
return (
179
179
< div className = { styles . wrapper } >
You can’t perform that action at this time.
0 commit comments