mirror of
https://github.com/ascribe/onion.git
synced 2024-12-22 09:23:13 +01:00
Fix PR comments
This commit is contained in:
parent
3461a28f36
commit
9b99e3ae09
@ -4,10 +4,10 @@ import history from '../../../../../../history';
|
||||
|
||||
|
||||
export function AuthPrizeRoleRedirect({ to, when }) {
|
||||
if(when.constructor !== Array && when.length) {
|
||||
if (when.constructor !== Array || !when.length) {
|
||||
throw new Error('`when` of AuthPrizeRoleRedirect must be an array containing values');
|
||||
}
|
||||
if(!to && to.indexOf('/') !== -1) {
|
||||
if (!to || to.indexOf('/') === -1) {
|
||||
throw new Error('`to` of AuthPrizeRoleRedirect must be defined and contain a valid route');
|
||||
}
|
||||
|
||||
@ -16,11 +16,11 @@ export function AuthPrizeRoleRedirect({ to, when }) {
|
||||
.map(role => currentUser[role])
|
||||
.reduce((a, b) => a || b);
|
||||
|
||||
if(exprToValidate) {
|
||||
if (exprToValidate) {
|
||||
window.setTimeout(() => history.replaceState(null, to, query));
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user