Fix routing issues. Fix panel layout.
This commit is contained in:
@@ -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}`} />
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user