App.js 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. import React from 'react';
  2. import { Router } from 'react-router-dom';
  3. import createHistory from "history/createBrowserHistory";
  4. import MainPage from "./pages/MainPage";
  5. import { Switch } from "react-router-dom"
  6. import {AboutUsPage} from "./pages/AboutUsPage/AboutUsPage";
  7. import {OurTeamPage} from "./pages/OurTeamPage/OurTeamPage";
  8. import { Provider } from "react-redux";
  9. import {store} from "./reducers";
  10. import Header from "./components/Header";
  11. import {CPRoute, CRRoute} from "./components/CPRoute";
  12. import AdminPage from "./pages/AdminPage/AdminPage";
  13. import Page404 from "./pages/404Page";
  14. import {FAQPage} from "./pages/FAQPage/FAQPage";
  15. import {CCatalogPage} from "./pages/Catalog/CatalogPage";
  16. import {ContactPage} from "./pages/Contact/ContactPage";
  17. import PrivacyPolicy from "./pages/PrivacyPolicyPage/PrivacyPolicyPage";
  18. import SearchPage from "./pages/SearchPage/SearchPage";
  19. import {CCartPage} from "./pages/CartPage/CartPage";
  20. import {MyOrdersPage} from "./pages/MyOrdersPage/MyOrdersPage";
  21. import {ProductPage} from "./pages/ProductPage/ProductPage";
  22. import {WishListPage} from "./pages/WishListPage/WishListPage";
  23. import MyAccountPage from "./pages/MyAccountPage/MyAccountPage";
  24. import {CProfilePage} from "./pages/ProfilePage/ProfilePage";
  25. import {Footer} from "./components/Footer/Footer";
  26. const history = createHistory();
  27. export const App = () => {
  28. return (
  29. <Router history={history}>
  30. <Provider store={store}>
  31. <Header/>
  32. <Switch>
  33. <CRRoute path="/" component={MainPage} exact/>
  34. <CRRoute path="/catalog" component={CCatalogPage} />
  35. <CRRoute path="/good" component={ProductPage} />
  36. <CRRoute path="/about-us" component={AboutUsPage} />
  37. <CRRoute path="/our-team" component={OurTeamPage} />
  38. <CRRoute path="/faq" component={FAQPage} />
  39. <CRRoute path="/contact" component={ContactPage} />
  40. <CRRoute path="/my-account" component={MyAccountPage} />
  41. <CRRoute path="/privacy-policy" component={PrivacyPolicy} />
  42. <CRRoute path="/search" component={SearchPage} />
  43. <CRRoute path="/basket" component={CCartPage} />
  44. <CRRoute path="/wish-list" component={WishListPage} />
  45. <CRRoute path="/my-orders" component={MyOrdersPage} />
  46. <CPRoute roles={["user", "admin"]} path="/profile" fallback='/my-account' component={CProfilePage} />
  47. <CPRoute roles={["admin"]} path="/admin" fallback='/my-account' component={AdminPage} />
  48. <CRRoute path="*" component={Page404} />
  49. </Switch>
  50. <Footer/>
  51. </Provider>
  52. </Router>
  53. )
  54. }