login
This commit is contained in:
+6
-2
@@ -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}>
|
||||
|
||||
Reference in New Issue
Block a user