App.js 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. import React from "react";
  2. import "bootstrap/dist/css/bootstrap.min.css";
  3. import "./icons/bootstrap-icons.css";
  4. import "./App.scss";
  5. import {
  6. // BrowserRouter as Router, // https://stackoverflow.com/questions/42701129/how-to-push-to-history-in-react-router-v4
  7. Router,
  8. Route,
  9. Link,
  10. Switch,
  11. NavLink,
  12. Redirect,
  13. } from "react-router-dom";
  14. import history from "./history";
  15. import { Provider, connect } from "react-redux";
  16. import { Header, Footer } from "./Layout";
  17. import { CPageMain, PageLogin, PageNewChat, PageUpload, PageAbout, CPageSearch } from "./Pages";
  18. import { actionFindChatsByUserId } from "./Actions";
  19. import { store } from "./Reducers";
  20. const PageNotFound = () => {
  21. setTimeout(() => {
  22. history.push("/main");
  23. }, 3000);
  24. return (
  25. <div>
  26. <b>404</b>
  27. </div>
  28. );
  29. };
  30. const App = () => (
  31. <Provider store={store}>
  32. <Router history={history}>
  33. <div className="mainWrapper">
  34. <Header />
  35. <Switch>
  36. <Route path="/about" component={PageAbout} exact />
  37. <Route path="/newchat" component={PageNewChat} exact />
  38. <Route path="/upload" component={PageUpload} exact />
  39. <Route path="/" component={PageLogin} exact />
  40. <Route path="/main/:_chatId" component={CPageMain} exact />
  41. <Route path="/main/" component={CPageMain} exact />
  42. <Route path="/search/" component={CPageSearch} exact />
  43. <Route component={PageNotFound} exact />
  44. </Switch>
  45. {/* <Footer /> */}
  46. </div>
  47. </Router>
  48. </Provider>
  49. );
  50. export default App;