Fix view/edit route redirect

This commit is contained in:
Maciej Ziarkowski 2019-10-15 14:53:01 +01:00
parent 3b8594a604
commit f498f4730b
2 changed files with 4 additions and 4 deletions

View File

@ -105,7 +105,7 @@ class App extends React.Component<AppProps, any> { // TODO: add proper types
<Route exact path="/data-accuracy.html" component={DataAccuracyPage} />
<Route exact path="/data-extracts.html" component={DataExtracts} />
<Route exact path="/contact.html" component={ContactPage} />
<Route exact path={["/", "/:mode(view|edit|multi-edit)/:category/:building(\\d+)?"]} render={(props) => (
<Route exact path={["/", "/:mode(view|edit|multi-edit)/:category?/:building(\\d+)?"]} render={(props) => (
<MapApp
{...props}
building={this.props.building}

View File

@ -234,9 +234,9 @@ class MapApp extends React.Component<MapAppProps, MapAppState> {
/>
</Sidebar>
</Route>
<Route exact path="/(view|edit|multi-edit)">
<Redirect to="/view/categories" />
</Route>
<Route exact path="/:mode(view|edit|multi-edit)"
render={props => (<Redirect to={`/${props.match.params.mode}/categories`} />)}
/>
</Switch>
<ColouringMap
building={this.state.building}