This commit is contained in:
timorls 2022-01-12 22:02:40 +08:00
parent 3e438ff723
commit 8da40f804a
1 changed files with 5 additions and 1 deletions

View File

@ -6,6 +6,7 @@ import Home from '@/pages/home'
import { Provider } from "react-redux"
import { HashRouter, Switch, Route, Redirect } from 'react-router-dom'
function App() {
return (
<Provider store={store}>
@ -13,7 +14,10 @@ function App() {
<HashRouter>
<Switch><Route path='/login' component={User} /></Switch>
<Switch><Route path='/home' component={Home} /></Switch>
<Redirect from="/" to="/home" exact />
<Redirect from="/" to={(() => {
return localStorage.getItem("token") ?
'/home' : '/login'
})()} exact />
</HashRouter>
</div>
</Provider>