Skip to content

Commit ddc77ee

Browse files
authored
기능개발 v1.2 유저 인증 로직 수정
2 parents 63793f7 + 9246cff commit ddc77ee

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)