summaryrefslogtreecommitdiff
path: root/src/routes/index.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/routes/index.js')
-rw-r--r--src/routes/index.js11
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>