Fix routing issues. Fix panel layout.

This commit is contained in:
John Lyon-Smith
2018-03-23 13:49:41 -07:00
parent 54365d3566
commit ce25d56dfe
17 changed files with 240 additions and 98 deletions

View File

@@ -6,14 +6,7 @@ import autobind from 'autobind-decorator'
export class ProtectedRoute extends React.Component {
static propTypes = {
location: PropTypes.shape({
pathname: PropTypes.string,
search: PropTypes.string,
}),
}
static defaultProps = {
roles: ['administrator']
location: PropTypes.shape({ pathname: PropTypes.string, search: PropTypes.string }),
}
@autobind
@@ -30,7 +23,7 @@ export class ProtectedRoute extends React.Component {
}
render(props) {
let user = api.loggedInUser
const user = api.loggedInUser
if (user) {
if (user.pending) {
@@ -40,8 +33,8 @@ export class ProtectedRoute extends React.Component {
} else if (user.administrator) {
return <Route {...this.props} />
}
} else {
return <Redirect to={`/login?redirect=${this.props.location.pathname}${this.props.location.search}`} />
}
return <Redirect to={`/login?redirect=${this.props.location.pathname}${this.props.location.search}`} />
}
}