aboutsummaryrefslogtreecommitdiff
path: root/src/client
diff options
context:
space:
mode:
authorNoah Loomans <noahloomans@gmail.com>2018-02-07 15:21:52 +0100
committerNoah Loomans <noahloomans@gmail.com>2018-02-07 15:21:52 +0100
commit5ebd34ed83f878976b89da78d6bdaa1dc9e935d7 (patch)
tree3af712d49db1f4fc1c39765b278068716eb41e64 /src/client
parent90eb2fec5e6e28b05f0b9511e8e539bcc42e0033 (diff)
Redirect to / on invalid url
Diffstat (limited to 'src/client')
-rw-r--r--src/client/react/index.js17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/client/react/index.js b/src/client/react/index.js
index 122d54b..3cabf9f 100644
--- a/src/client/react/index.js
+++ b/src/client/react/index.js
@@ -1,11 +1,19 @@
import React from 'react';
import ReactDOM from 'react-dom';
import moment from 'moment';
-import { Provider } from 'react-redux';
-import { BrowserRouter as Router, Route } from 'react-router-dom';
+
import { createStore, applyMiddleware, compose } from 'redux';
+import { Provider } from 'react-redux';
import logger from 'redux-logger';
import thunk from 'redux-thunk';
+
+import {
+ BrowserRouter as Router,
+ Route,
+ Switch,
+ Redirect,
+} from 'react-router-dom';
+
import reducer from './reducers';
import Index from './components/page/Index';
import User from './components/page/User';
@@ -22,10 +30,11 @@ const store = createStore(
ReactDOM.render(
<Provider store={store}>
<Router>
- <div>
+ <Switch>
<Route exact path="/" component={Index} />
<Route path="/:type/:value" component={User} />
- </div>
+ <Redirect to="/" />
+ </Switch>
</Router>
</Provider>,
document.getElementById('root'),