#122: fix error during redirect

This commit is contained in:
SleepWalker 2016-05-30 07:23:27 +03:00
parent c66c2ac446
commit c73991c14f
2 changed files with 6 additions and 4 deletions

View File

@ -5,10 +5,7 @@ import {updateUser} from 'components/user/actions';
const availableActions = { const availableActions = {
...actions, ...actions,
updateUser, updateUser
redirect(url) {
location.href = url;
}
}; };
export default new AuthFlow(availableActions); export default new AuthFlow(availableActions);

View File

@ -53,6 +53,11 @@ export default class AuthFlow {
} }
run(actionId, payload) { run(actionId, payload) {
if (actionId === 'redirect') {
location.href = payload;
return;
}
if (!this.actions[actionId]) { if (!this.actions[actionId]) {
throw new Error(`Action ${actionId} does not exists`); throw new Error(`Action ${actionId} does not exists`);
} }