diff options
| author | Georgios Andreadis <g.andreadis@student.tudelft.nl> | 2017-10-04 22:49:07 +0200 |
|---|---|---|
| committer | Georgios Andreadis <g.andreadis@student.tudelft.nl> | 2017-10-04 22:49:25 +0200 |
| commit | 751a9ef3a12c952fe179f256d854d0c4aa37e28e (patch) | |
| tree | 241fc22c592a277526e73cc70ea0f95d5a8a7b29 /src/routes | |
| parent | 9257d89ec2e22b65ffecc7dc7cf67b7a74c34d60 (diff) | |
Apply prettier to codebase
Diffstat (limited to 'src/routes')
| -rw-r--r-- | src/routes/index.js | 76 |
1 files changed, 49 insertions, 27 deletions
diff --git a/src/routes/index.js b/src/routes/index.js index 96ac885c..f7523458 100644 --- a/src/routes/index.js +++ b/src/routes/index.js @@ -1,6 +1,6 @@ -import React from 'react'; -import {BrowserRouter, Redirect, Route, Switch} from "react-router-dom"; -import {userIsLoggedIn} from "../auth/index"; +import React from "react"; +import { BrowserRouter, Redirect, Route, Switch } from "react-router-dom"; +import { userIsLoggedIn } from "../auth/index"; import App from "../pages/App"; import Experiments from "../pages/Experiments"; import Home from "../pages/Home"; @@ -8,35 +8,57 @@ import NotFound from "../pages/NotFound"; import Profile from "../pages/Profile"; import Simulations from "../pages/Simulations"; -const ProtectedComponent = (component) => () => userIsLoggedIn() ? component : <Redirect to="/"/>; -const AppComponent = ({match}) => userIsLoggedIn() ? - <App simulationId={parseInt(match.params.simulationId, 10)}/> : - <Redirect to="/"/>; +const ProtectedComponent = component => () => + userIsLoggedIn() ? component : <Redirect to="/" />; +const AppComponent = ({ match }) => + userIsLoggedIn() ? ( + <App simulationId={parseInt(match.params.simulationId, 10)} /> + ) : ( + <Redirect to="/" /> + ); -const ExperimentsComponent = ({match}) => userIsLoggedIn() ? - <Experiments simulationId={parseInt(match.params.simulationId, 10)}/> : - <Redirect to="/"/>; +const ExperimentsComponent = ({ match }) => + userIsLoggedIn() ? ( + <Experiments simulationId={parseInt(match.params.simulationId, 10)} /> + ) : ( + <Redirect to="/" /> + ); -const SimulationComponent = ({match}) => userIsLoggedIn() ? +const SimulationComponent = ({ match }) => + userIsLoggedIn() ? ( <App - simulationId={parseInt(match.params.simulationId, 10)} - inSimulation={true} - experimentId={parseInt(match.params.experimentId, 10)} - /> : - <Redirect to="/"/>; + simulationId={parseInt(match.params.simulationId, 10)} + inSimulation={true} + experimentId={parseInt(match.params.experimentId, 10)} + /> + ) : ( + <Redirect to="/" /> + ); const Routes = () => ( - <BrowserRouter> - <Switch> - <Route exact path="/" component={Home}/> - <Route exact path="/simulations" render={ProtectedComponent(<Simulations/>)}/> - <Route exact path="/simulations/:simulationId" component={AppComponent}/> - <Route exact path="/simulations/:simulationId/experiments" component={ExperimentsComponent}/> - <Route exact path="/simulations/:simulationId/experiments/:experimentId" component={SimulationComponent}/> - <Route exact path="/profile" render={ProtectedComponent(<Profile/>)}/> - <Route path="/*" component={NotFound}/> - </Switch> - </BrowserRouter> + <BrowserRouter> + <Switch> + <Route exact path="/" component={Home} /> + <Route + exact + path="/simulations" + render={ProtectedComponent(<Simulations />)} + /> + <Route exact path="/simulations/:simulationId" component={AppComponent} /> + <Route + exact + path="/simulations/:simulationId/experiments" + component={ExperimentsComponent} + /> + <Route + exact + path="/simulations/:simulationId/experiments/:experimentId" + component={SimulationComponent} + /> + <Route exact path="/profile" render={ProtectedComponent(<Profile />)} /> + <Route path="/*" component={NotFound} /> + </Switch> + </BrowserRouter> ); export default Routes; |
