Skip to content

Commit

Permalink
presist auth status
Browse files Browse the repository at this point in the history
  • Loading branch information
mehdi-torabiv committed Aug 30, 2024
1 parent d00a199 commit 43136d4
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,19 @@ const App: React.FC = () => {
},
});

useEffect(() => {
const checkStoredToken = () => {
const OCI_TOKEN = localStorage.getItem('OCI_TOKEN');
if (OCI_TOKEN) {
setAuthStatus('authenticated');
} else {
setAuthStatus('unauthenticated');
}
};

checkStoredToken();
}, []);

useEffect(() => {
console.log('authStatus', authStatus);
}, [authStatus]);
Expand Down

0 comments on commit 43136d4

Please sign in to comment.