Skip to content

Commit 0bbe055

Browse files
committed
feat: check login
1 parent 411cc81 commit 0bbe055

File tree

2 files changed

+14
-23
lines changed

2 files changed

+14
-23
lines changed

frontend/src/App.tsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,27 @@ import LoginModal from './components/LoginModal';
1616
import LocationModal from './components/LocationModal';
1717
import TargetPriceModal from './components/TargetPriceModal';
1818
import Main from './components/Main';
19+
import { useRecoilValue } from 'recoil';
20+
import GlobalState from './GlobalState';
21+
import { useEffect } from 'react';
22+
import { useNavigate } from 'react-router';
1923

2024
export interface TodoItem1 {
2125
name: string;
2226
id: string;
2327
}
2428

2529
function App() {
30+
const globalJwtTokenState = useRecoilValue(GlobalState.jwtTokenState);
31+
const globalUserUuidState = useRecoilValue(GlobalState.userUuidState);
32+
const navigate = useNavigate();
33+
34+
useEffect(() => {
35+
if((!globalJwtTokenState || !globalUserUuidState || globalJwtTokenState.length < 10 || globalUserUuidState.length < 10)) {
36+
navigate('/');
37+
}
38+
});
39+
2640
return (
2741
<div className="App">
2842
<Header/>

frontend/src/configureRoutes.tsx

Lines changed: 0 additions & 23 deletions
This file was deleted.

0 commit comments

Comments
 (0)