diff options
| author | Georgios Andreadis <g.andreadis@student.tudelft.nl> | 2017-08-11 14:48:42 +0300 |
|---|---|---|
| committer | Georgios Andreadis <g.andreadis@student.tudelft.nl> | 2017-09-23 10:05:37 +0200 |
| commit | d7512ace72448242b392299cf459c9c72c8dbee5 (patch) | |
| tree | 37ce113d5d47440139bfe357e9ad547063cd44f7 /src/routes/index.js | |
| parent | 737ce62470a13ae153788207719396e107252955 (diff) | |
Get Google authentication flow working
Diffstat (limited to 'src/routes/index.js')
| -rw-r--r-- | src/routes/index.js | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/routes/index.js b/src/routes/index.js index 54dc0703..6b3a454d 100644 --- a/src/routes/index.js +++ b/src/routes/index.js @@ -1,5 +1,6 @@ import React from 'react'; -import {BrowserRouter, Route, Switch} from "react-router-dom"; +import {BrowserRouter, Redirect, Route, Switch} from "react-router-dom"; +import {userIsLoggedIn} from "../auth/index"; import Home from "../pages/Home"; import NotFound from "../pages/NotFound"; import Projects from "../pages/Projects"; @@ -8,7 +9,13 @@ const Routes = () => ( <BrowserRouter> <Switch> <Route exact path="/" component={Home}/> - <Route exact path="/projects" component={Projects}/> + <Route exact path="/projects" render={() => ( + userIsLoggedIn() ? ( + <Projects/> + ) : ( + <Redirect to="/"/> + ) + )}/> <Route path="/*" component={NotFound}/> </Switch> </BrowserRouter> |
