1
0
mirror of https://github.com/ascribe/onion.git synced 2025-01-03 18:35:09 +01:00

Fix PR comments

This commit is contained in:
Brett Sun 2015-12-10 11:11:37 +01:00
parent 3461a28f36
commit 9b99e3ae09

View File

@ -4,10 +4,10 @@ import history from '../../../../../../history';
export function AuthPrizeRoleRedirect({ to, when }) { 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'); 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'); throw new Error('`to` of AuthPrizeRoleRedirect must be defined and contain a valid route');
} }
@ -16,7 +16,7 @@ export function AuthPrizeRoleRedirect({ to, when }) {
.map(role => currentUser[role]) .map(role => currentUser[role])
.reduce((a, b) => a || b); .reduce((a, b) => a || b);
if(exprToValidate) { if (exprToValidate) {
window.setTimeout(() => history.replaceState(null, to, query)); window.setTimeout(() => history.replaceState(null, to, query));
return true; return true;
} else { } else {