Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions lib/components/AuthorizedComponent.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ class AuthorizedComponent extends React.Component {
// @param routeRoles roles defending the route requested
// @param userRoles roles of the user accessing the component
handleUnauthorizedRole(routeRoles, userRoles) {
if (typeof this.notAuthorizedPath === 'undefined') {
throw new Error('AuthorizedComponent: No not authorized path defined! Please define it in the constructor of your component.');
}

const { router } = this.context;
router.push(this.notAuthorizedPath);
}
Expand All @@ -47,10 +51,6 @@ class AuthorizedComponent extends React.Component {
if (typeof this.userRoles === 'undefined') {
throw new Error('AuthorizedComponent: No user roles defined! Please define them in the constructor of your component.');
}

if (typeof this.notAuthorizedPath === 'undefined') {
throw new Error('AuthorizedComponent: No not authorized path defined! Please define it in the constructor of your component.');
}
}
}

Expand Down