123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- import {Router, Route} from 'react-router-dom';
- import createHistory from "history/createBrowserHistory";
- import MainPage from "./pages/MainPage";
- import Page404 from "./pages/404Page";
- import ContactPage from "./pages/ContactPage";
- import Switch from "react-router-dom/es/Switch";
- import PrivacyPolicy from "./pages/PrivacyPolicyPage";
- import FAQPage from "./pages/FAQPage";
- import OurTeamPage from "./pages/OurTeamPage";
- import AboutUsPage from "./pages/AboutUsPage";
- import {Provider} from "react-redux";
- import MyAccountPage from "./pages/MyAccountPage";
- import {store} from "./reducers";
- import ProfilePage from "./pages/ProfilePage";
- import CatalogPage from "./pages/CatalogPage";
- import Header from "./components/Header";
- import Footer from "./components/Footer";
- import ProductPage from "./pages/ProductPage";
- import WishListPage from "./pages/WishListPage";
- import SearchPage from "./pages/SearchPage";
- import MyOrdersPage from "./pages/MyOrdersPage";
- import CartPage from "./pages/CartPage";
- import {CPRoute} from "./components/CPRoute";
- import AdminPage from "./pages/AdminPage";
- const history = createHistory();
- function App() {
- return (
- <Router history={history}>
- <Provider store={store}>
- <Header/>
- <Switch>
- <Route path="/" component={MainPage} exact/>
- <Route path="/catalog" component={CatalogPage} />
- <Route path="/good" component={ProductPage} />
- <Route path="/about-us" component={AboutUsPage} />
- <Route path="/our-team" component={OurTeamPage} />
- <Route path="/faq" component={FAQPage} />
- <Route path="/contact" component={ContactPage} />
- <Route path="/my-account" component={MyAccountPage} />
- <Route path="/privacy-policy" component={PrivacyPolicy} />
- <Route path="/search" component={SearchPage} />
- <Route path="/basket" component={CartPage} />
- <Route path="/wish-list" component={WishListPage} />
- <Route path="/my-orders" component={MyOrdersPage} />
- <CPRoute roles={["user", "admin"]} path="/profile" fallback='/my-account' component={ProfilePage} />
- <CPRoute roles={["admin"]} path="/admin" fallback='/my-account' component={AdminPage} />
- <Route path="*" component={Page404} />
- </Switch>
- <Footer/>
- </Provider>
- </Router>
- )
- }
- export default App;
|