Fixing last couple of auth dialogs
This commit is contained in:
@@ -7,6 +7,7 @@ import autobind from 'autobind-decorator'
|
||||
export class ProtectedRoute extends React.Component {
|
||||
static propTypes = {
|
||||
location: PropTypes.shape({ pathname: PropTypes.string, search: PropTypes.string }),
|
||||
admin: PropTypes.bool,
|
||||
}
|
||||
|
||||
@autobind
|
||||
@@ -30,11 +31,11 @@ export class ProtectedRoute extends React.Component {
|
||||
// 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 <div />
|
||||
} else if (user.administrator) {
|
||||
} else if (!this.props.admin || (this.props.admin && 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}`} />
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user