This commit is contained in:
hamid zarghami
2024-12-24 11:43:25 +03:30
parent 67135204ab
commit 6d5ce71b2f
17 changed files with 609 additions and 51 deletions
+6 -2
View File
@@ -39,18 +39,22 @@ const queryClient = new QueryClient({
const App: FC = () => {
const [isLogin, setIsLogin] = useState<'checking' | 'isLogin' | 'isNotLogin'>('checking')
useEffect(() => {
if (localStorage.getItem(import.meta.env.VITE_TOKEN_NAME)) {
setIsLogin('isLogin')
} else {
setIsLogin('isNotLogin')
window.location.href = Pages.auth.login
if (window.location.href.split('auth').length === 1) {
window.location.href = Pages.auth.login
}
}
}, [])
console.log('us', isLogin);
return (
<BrowserRouter>
<QueryClientProvider client={queryClient}>