Skip to content

Commit 8160136

Browse files
committed
fix: 인증 정보 검사 로직 수정
1 parent 295a01d commit 8160136

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

src/App.tsx

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,17 @@ 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+
await getUserInfoApi(currentUserId);
48+
} catch (error) {
49+
setIsAuthenticated(false);
50+
}
4351
};
4452
checkAuth();
4553
}, []);

0 commit comments

Comments
 (0)