App.js 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. import React from 'react';
  2. import './App.scss';
  3. import {Provider, connect} from 'react-redux';
  4. import thunk from 'redux-thunk';
  5. import {createStore, combineReducers, applyMiddleware} from 'redux';
  6. import {Navibar} from './Components/NaviBar';
  7. import Footer from './Components/Footer';
  8. import { createBrowserHistory } from "history";
  9. import { actionAuthLogout } from './actions';
  10. import store from './reducers';
  11. import ConnectLog from './pages/Login';
  12. import { Router,Switch, Route, Link, useHistory } from "react-router-dom";
  13. import TypeAd, {Home} from "./pages/Home";
  14. import TypeAdOne from './pages/AdOne';
  15. import ConnectSign from './pages/Sign';
  16. import {Login} from "./pages/Login";
  17. import {Instruction} from "./pages/Instriction";
  18. import {Advertisment} from "./pages/Advertisment";
  19. import RoleRoute from './Components/PrivateRoute';
  20. import ConnectNav from './Components/NaviBar';
  21. import CProfile from './Components/Profile';
  22. import CPost from './pages/PostAd';
  23. import СChange from './pages/EditAd';
  24. import Profile from './pages/Profile';
  25. import AdSearch from './pages/Search';
  26. function App() {
  27. return (
  28. <>
  29. <Provider store={store}>
  30. <Router history = {createBrowserHistory()}>
  31. <ConnectNav />
  32. <Switch>
  33. <RoleRoute exact path='/' roles ={['user']} component = {TypeAd} />
  34. <RoleRoute path='/home/:id' roles={['user']} component={TypeAdOne} exact/>
  35. <RoleRoute path='/home/edit/:id' roles={['user']} component={СChange} exact/>
  36. <RoleRoute path='/login' roles={['unknown']} component={ConnectLog}/>
  37. <RoleRoute path='/sign' roles={['unknown']} component={ConnectSign}/>
  38. <RoleRoute path='/search/' roles={['unknown']} component={AdSearch} />
  39. <RoleRoute path='/profile' roles={['user']} component={Profile} />
  40. <RoleRoute path='/post-ad' roles={['user']} component={CPost} />
  41. <RoleRoute path='/instruction' roles={['unknown']} component={Instruction} />
  42. <RoleRoute path='/advertisment' roles={['unknown']} component={Advertisment} />
  43. </Switch>
  44. <Footer />
  45. </Router>
  46. </Provider>
  47. </>
  48. );
  49. }
  50. export default App;