Advertisement
Guest User

Untitled

a guest
Sep 26th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /* tslint:disable */
  2. // @ts-ignore
  3. require("./images/fav");
  4. /* tslint:enable */
  5. import "./styles/style.scss";
  6.  
  7. import * as React from "react";
  8. import * as ReactDOM from "react-dom";
  9. import { Route, Router, Switch } from "react-router-dom";
  10.  
  11. import Form from "./components/views/Form";
  12. import Home from "./components/views/Home";
  13. import Room from "./components/views/Room";
  14. import History from "./history";
  15. import { ConnectedRouter } from "connected-react-router";
  16. import { Provider } from "react-redux";
  17. import store from "./store";
  18.  
  19. /* tslint:disable */
  20. // @ts-ignore
  21. if (typeof window.ga !== "undefined") {
  22.   History.listen((location) => {
  23.     // @ts-ignore
  24.     window.ga('set', 'page', location.pathname + location.search);
  25.     // @ts-ignore
  26.     window.ga('send', 'pageview');
  27.   });
  28. }
  29. /* tslint:enable */
  30.  
  31. class App extends React.Component<{}, {}> {
  32.   public render() {
  33.     return (
  34.       <Provider store={store}>
  35.         <ConnectedRouter history={History}>
  36.           <Router history={History}>
  37.             <Switch>
  38.               <Route path="/" exact={true} component={Home}/>
  39.               <Route path="/room/:id" exact={true} component={Room}/>
  40.               <Route path="/submit" exact={true} component={Form}/>
  41.             </Switch>
  42.           </Router>
  43.         </ConnectedRouter>
  44.       </Provider>
  45.     );
  46.   }
  47. }
  48.  
  49. const app: HTMLElement | null = document.getElementById("app");
  50.  
  51. ReactDOM.render(
  52.   <App />,
  53.   app
  54. );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement