diff --git a/website/src/App.js b/website/src/App.js index 2860619..b022407 100644 --- a/website/src/App.js +++ b/website/src/App.js @@ -56,39 +56,40 @@ export class App extends Component { } return ( - - - - - {headerButtonsLeft} - - {headerButtonsRight} - - - - - - + + + + + + {headerButtonsLeft} + + {headerButtonsRight} + + + + + - - - - {/* No Match Route */} + + + + + - - - - - - {'v' + versionInfo.version} {versionInfo.copyright} - - - + + + + + {'v' + versionInfo.version} {versionInfo.copyright} + + + + ) } } diff --git a/website/src/Auth/ProtectedRoute.js b/website/src/Auth/ProtectedRoute.js index 49a8d72..7cbca82 100644 --- a/website/src/Auth/ProtectedRoute.js +++ b/website/src/Auth/ProtectedRoute.js @@ -12,6 +12,10 @@ export class ProtectedRoute extends React.Component { }), } + static defaultProps = { + roles: ['administrator'] + } + constructor(props) { super(props) this.updateComponent = this.updateComponent.bind(this) @@ -34,17 +38,17 @@ export class ProtectedRoute extends React.Component { if (user) { if (user.pending) { - // The Api might be in the middle of fetching the user information + // The API might be in the middle of fetching the user information + // Return something and wait for login evint to fire to re-render return
} + let roles = this.props.roles - if (!roles || roles.includes(user.role)) { + if (roles && roles.includes(user.role)) { return - } else if (!!user.role && user.role === 'broker') { - return - } else if (!!user.role && (user.role === 'employee' || 'administrator' || 'executive')) { - return + } else { + return } } else { return diff --git a/website/src/Home/Home.js b/website/src/Home/Home.js index 4939e0c..7cd091b 100644 --- a/website/src/Home/Home.js +++ b/website/src/Home/Home.js @@ -1,7 +1,12 @@ import React from 'react' +import PropTypes from 'prop-types' import { Row, Column, PanelButton } from 'ui' export class Home extends React.Component { + static propTypes = { + history: PropTypes.object + } + render() { return ( @@ -10,7 +15,7 @@ export class Home extends React.Component { - + (this.props.history.replace('/users'))} />