We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 295a01d commit 8160136Copy full SHA for 8160136
1 file changed
src/App.tsx
@@ -37,9 +37,17 @@ const ProtectedRoute = ({ children }: { children: JSX.Element }) => {
37
38
useEffect(() => {
39
const checkAuth = async () => {
40
- const currentUserId = getCurrentUserId();
41
- const response = await getUserInfoApi(currentUserId);
42
- setIsAuthenticated(response.isSuccess);
+ try {
+ const currentUserId = getCurrentUserId();
+ if (!currentUserId) {
43
+ setIsAuthenticated(false);
44
+ return;
45
+ }
46
+
47
+ await getUserInfoApi(currentUserId);
48
+ } catch (error) {
49
50
51
};
52
checkAuth();
53
}, []);
0 commit comments