Redirect from edit if not logged in

This commit is contained in:
Tom Russell 2018-09-13 22:19:55 +01:00
parent 4c2aecd73d
commit 3baccffd36

View File

@ -1,5 +1,5 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import { Link } from 'react-router-dom'; import { Link, Redirect } from 'react-router-dom';
import ErrorBox from './error-box'; import ErrorBox from './error-box';
import InfoBox from './info-box'; import InfoBox from './info-box';
@ -87,6 +87,9 @@ class BuildingEdit extends Component {
} }
render() { render() {
if (!this.props.user){
return <Redirect to="/sign-up.html" />
}
if (!this.props.id){ if (!this.props.id){
return ( return (
<Sidebar title="Building Not Found"> <Sidebar title="Building Not Found">