Redirect from edit if not logged in

This commit is contained in:
Tom Russell 2018-11-21 22:19:51 +00:00
parent 298c55038c
commit 447b5acf09
2 changed files with 13 additions and 7 deletions

View File

@ -84,7 +84,7 @@ class App extends React.Component {
<Welcome />
</Route>
<Route exact path="/select.html">
<BuildingEditAny />
<BuildingEditAny user={this.state.user} />
</Route>
<Route exact path="/map/:map.html" component={Legend} />
<Route exact path="/building/:building.html" render={(props) => (

View File

@ -1,11 +1,17 @@
import React from 'react';
import Sidebar from './sidebar';
import InfoBox from './info-box';
import { Redirect } from 'react-router-dom';
const BuildingEditAny = () => (
const BuildingEditAny = (props) => {
if (!props.user){
return <Redirect to="/sign-up.html" />
}
return (
<Sidebar title="Edit data">
<p className="data-intro">Select a building to edit by clicking on the map&hellip;</p>
<InfoBox msg="Select a building to edit by clicking on the map&hellip;" />
</Sidebar>
);
}
export default BuildingEditAny;