Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. import React from "react";
  2. import { Redirect, Route, Switch } from "react-router-dom";
  3. import {
  4. LOGIN_PAGE,
  5. ADMIN_LOGIN_PAGE,
  6. HOME_PAGE,
  7. NOT_FOUND_PAGE,
  8. ERROR_PAGE,
  9. BASE_PAGE,
  10. FORGOT_PASSWORD_MAIL_SENT,
  11. REGISTER_PAGE,
  12. REGISTER_SUCCESSFUL_PAGE,
  13. RESET_PASSWORD_PAGE,
  14. CREATE_OFFER_PAGE,
  15. ITEM_DETAILS_PAGE,
  16. FORGOT_PASSWORD_PAGE,
  17. PROFILE_PAGE,
  18. MY_OFFERS_PAGE,
  19. ABOUT_PAGE,
  20. ADMIN_HOME_PAGE,
  21. MESSAGES_LIST_PAGE,
  22. DIRECT_CHAT_PAGE,
  23. MARKETPLACE_PAGE,
  24. } from "./constants/pages";
  25. import LoginPage from "./pages/LoginPage/LoginPage";
  26. import AdminLoginPage from "./pages/AdminLoginPage/AdminLoginPage";
  27. import HomePage from "./pages/HomePage/HomePage";
  28. import NotFoundPage from "./pages/ErrorPages/NotFoundPage";
  29. import ErrorPage from "./pages/ErrorPages/ErrorPage";
  30. import ForgotPasswordPage from "./pages/ForgotPasswordPage/ForgotPasswordPage";
  31. import PrivateRoute from "./components/Router/PrivateRoute";
  32. import MailSent from "./pages/ForgotPasswordPage/ForgotPasswordMailSent/MailSent";
  33. import Register from "./pages/RegisterPages/Register/Register";
  34. import RegisterSuccessful from "./pages/RegisterPages/RegisterSuccessful.js/RegisterSuccessful";
  35. import ResetPasswordPage from "./pages/ResetPasswordPage/ResetPasswordPage";
  36. import CreateOffer from "./pages/CreateOffer/CreateOffer";
  37. import ItemDetailsPage from "./pages/ItemDetailsPage/ItemDetailsPageMUI";
  38. import ProfilePage from "./pages/ProfilePage/ProfilePage";
  39. import DirectChatPage from "./pages/DirectChatPage/DirectChatPage";
  40. import MessagesListPage from "./pages/MessagesListPage/MessagesListPage";
  41. import MyOffers from "./pages/MyOffers/MyOffers";
  42. import AboutPage from "./pages/About/AboutPage";
  43. import AuthRoute from "./components/Router/AuthRoute";
  44. import AdminRoute from "./components/Router/AdminRoute";
  45. import AdminHomePage from "./pages/AdminHomePage/AdminHomePage";
  46. import MarketplacePage from "./pages/Marketplace/MarketplacePage";
  47. const AppRoutes = () => {
  48. return (
  49. <Switch>
  50. <Route exact path={BASE_PAGE} component={HomePage} />
  51. <AuthRoute exact path={LOGIN_PAGE} component={LoginPage} />
  52. <AuthRoute exact path={ADMIN_LOGIN_PAGE} component={AdminLoginPage} />
  53. <AuthRoute exact path={REGISTER_PAGE} component={Register} />
  54. <AuthRoute path={FORGOT_PASSWORD_MAIL_SENT} component={MailSent} />
  55. <AuthRoute path={FORGOT_PASSWORD_PAGE} component={ForgotPasswordPage} />
  56. <AuthRoute path={RESET_PASSWORD_PAGE} component={ResetPasswordPage} />
  57. <Route path={REGISTER_SUCCESSFUL_PAGE} component={RegisterSuccessful} />
  58. <Route path={MARKETPLACE_PAGE} component={MarketplacePage} />
  59. <Route path={CREATE_OFFER_PAGE} component={CreateOffer} />
  60. <Route path={ITEM_DETAILS_PAGE} component={ItemDetailsPage} />
  61. <Route path={PROFILE_PAGE} component={ProfilePage} />
  62. <Route path={ABOUT_PAGE} component={AboutPage} />
  63. <Route path={HOME_PAGE} component={HomePage} />
  64. <PrivateRoute
  65. exact
  66. path={MESSAGES_LIST_PAGE}
  67. component={MessagesListPage}
  68. />
  69. <PrivateRoute path={DIRECT_CHAT_PAGE} component={DirectChatPage} />
  70. <PrivateRoute path={MY_OFFERS_PAGE} component={MyOffers} />
  71. <AdminRoute path={ADMIN_HOME_PAGE} component={AdminHomePage} />
  72. <Route path={ERROR_PAGE} component={ErrorPage} />
  73. <Route path={NOT_FOUND_PAGE} component={NotFoundPage} />
  74. <Redirect from="*" to={NOT_FOUND_PAGE} />
  75. </Switch>
  76. );
  77. };
  78. export default AppRoutes;