App.js 2.7 KB

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