From 43136d4de4b8078c4d26e71b316f11d1f8af79bd Mon Sep 17 00:00:00 2001 From: mehditorabiv Date: Fri, 30 Aug 2024 15:22:30 +0300 Subject: [PATCH] presist auth status --- src/App.tsx | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/App.tsx b/src/App.tsx index b4b065d..33dd9fd 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -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]);