New assets, fixed list box scrolling, header text, etc..
This commit is contained in:
@@ -5,7 +5,6 @@ import { api } from 'src/API'
|
||||
|
||||
export class ProtectedRoute extends React.Component {
|
||||
static propTypes = {
|
||||
roles: PropTypes.array,
|
||||
location: PropTypes.shape({
|
||||
pathname: PropTypes.string,
|
||||
search: PropTypes.string,
|
||||
@@ -41,17 +40,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 />
|
||||
}
|
||||
|
||||
let roles = this.props.roles
|
||||
|
||||
if (roles && roles.includes(user.role)) {
|
||||
} else if (user.administrator) {
|
||||
return <Route {...this.props} />
|
||||
} else {
|
||||
return <Redirect to='/' />
|
||||
}
|
||||
} 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