123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- import 'antd/dist/antd.css'
- import './App.scss';
- import { Router, Route, Switch, Redirect } from 'react-router-dom';
- import createHistory from "history/createBrowserHistory";
- import { connect, Provider } from 'react-redux';
- import { store } from './redux/redux-store';
- import { Authorization } from './pages/Authorization';
- import { Content } from './pages/Content';
- export const history = createHistory()
- const AppContent = ({ isToken }) =>
- <Router history={history}>
- {!isToken
- ?
- <Switch>
- <Route path='/auth/:_id'
- component={Authorization} />
- <Redirect from='/*' to='/auth/login' />
- </Switch>
- :
- <Content />
- // <Switch>
- // <Route path='/' component={Content} exact />
- // <Redirect from='/auth/*' to='/' />
- // </Switch>
- }
- </Router >
- const CAppContent = connect(state => ({ isToken: state.auth?.token }))(AppContent)
- store.subscribe(() => console.log(store.getState()))
- function App() {
- return (
- <Provider store={store}>
- <CAppContent />
- </Provider>
- )
- }
- export default App;
|