|
1 | 1 | import React from 'react' |
2 | | -import {BrowserRouter, Match, Miss, Redirect, Link} from 'react-router' |
| 2 | +import { BrowserRouter, Route, Redirect, Link, Switch } from 'react-router-dom' |
3 | 3 | import { Dimmer, Loader } from 'semantic-ui-react' |
4 | 4 | import Home from '../../pages/Home' |
5 | 5 | import CaseStudies from '../../pages/CaseStudies' |
@@ -35,7 +35,7 @@ class MatchWhenAuthorized extends React.Component { // eslint-disable-line |
35 | 35 | render() { |
36 | 36 | const {component: Component, ...rest} = this.props |
37 | 37 |
|
38 | | - return <Match {...rest} render={props => { |
| 38 | + return <Route {...rest} render={props => { |
39 | 39 | if (!isAuthenticated()) return <Redirect to={{ pathname: '/', state: { from: props.location } }}/> |
40 | 40 |
|
41 | 41 | return this.state.apiGatewayClient ? <Component {...props} />: (<Dimmer active> |
@@ -67,14 +67,15 @@ export default class App extends React.Component { |
67 | 67 | </div> |
68 | 68 | <section className="App-intro"> |
69 | 69 | <AlertPopup /> |
70 | | - |
71 | | - <Match exactly pattern="/" component={Home} /> |
72 | | - <Match pattern="/case-studies" component={CaseStudies} /> |
73 | | - <Match pattern="/getting-started" component={GettingStarted} /> |
74 | | - <Match pattern="/dashboard" component={Dashboard}/> |
75 | | - <Match exactly pattern="/apis" component={Apis}/> |
76 | | - <Match pattern="/apis/:apiId" component={ApiDetails}/> |
77 | | - <Miss component={NoMatch}/> |
| 70 | + <Switch> |
| 71 | + <Route exact path="/" component={Home} /> |
| 72 | + <Route path="/case-studies" component={CaseStudies} /> |
| 73 | + <Route path="/getting-started" component={GettingStarted} /> |
| 74 | + <Route path="/dashboard" component={Dashboard}/> |
| 75 | + <Route exact path="/apis" component={Apis}/> |
| 76 | + <Route path="/apis/:apiId" component={ApiDetails}/> |
| 77 | + <Route component={NoMatch}/> |
| 78 | + </Switch> |
78 | 79 | </section> |
79 | 80 | </div> |
80 | 81 | </BrowserRouter> |
|
0 commit comments