Skip to content

Commit 9246cff

Browse files
authored
Merge pull request #138 from oodd-team/feat/OD-207
[OD-207] 인증 정보 검사 로직 수정
2 parents 295a01d + f4ed3eb commit 9246cff

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

src/App.tsx

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,18 @@ const ProtectedRoute = ({ children }: { children: JSX.Element }) => {
3737

3838
useEffect(() => {
3939
const checkAuth = async () => {
40-
const currentUserId = getCurrentUserId();
41-
const response = await getUserInfoApi(currentUserId);
42-
setIsAuthenticated(response.isSuccess);
40+
try {
41+
const currentUserId = getCurrentUserId();
42+
if (!currentUserId) {
43+
setIsAuthenticated(false);
44+
return;
45+
}
46+
47+
const response = await getUserInfoApi(currentUserId);
48+
setIsAuthenticated(response.isSuccess);
49+
} catch (error) {
50+
setIsAuthenticated(false);
51+
}
4352
};
4453
checkAuth();
4554
}, []);

0 commit comments

Comments
 (0)