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 /> <Welcome />
</Route> </Route>
<Route exact path="/select.html"> <Route exact path="/select.html">
<BuildingEditAny /> <BuildingEditAny user={this.state.user} />
</Route> </Route>
<Route exact path="/map/:map.html" component={Legend} /> <Route exact path="/map/:map.html" component={Legend} />
<Route exact path="/building/:building.html" render={(props) => ( <Route exact path="/building/:building.html" render={(props) => (

View File

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