App.js 1002 B

12345678910111213141516171819202122232425262728293031323334
  1. import './App.scss'
  2. import { Provider, connect } from 'react-redux'
  3. import { Router, Route, Redirect, Switch } from 'react-router-dom'
  4. import React from 'react'
  5. import { store } from './redux'
  6. import 'antd/dist/antd.css'
  7. import { actionFullProfilePage } from './redux/saga'
  8. import { actionFullAllGetPosts } from './actions'
  9. import { CShowHeader } from './pages/header'
  10. import { CRouting } from './components/Routing'
  11. import {history} from './helpers'
  12. console.log(store.getState())
  13. store.subscribe(() => console.log(store.getState()))
  14. console.log('ABOUT ME', store.getState().auth?.payload?.sub?.id)
  15. function App() {
  16. if (store.getState().auth?.token) {
  17. console.log('токен', store.getState().auth?.payload?.sub?.id)
  18. store.dispatch(actionFullProfilePage())
  19. }
  20. return (
  21. <Router history={history}>
  22. <Provider store={store}>
  23. <div className="App">
  24. <CRouting />
  25. <CShowHeader />
  26. </div>
  27. </Provider>
  28. </Router>
  29. )
  30. }
  31. export default App