Returning a promise on logout and delegating login redireciton

This commit is contained in:
Bruno Alves de Faria committed 2017-09-28 08:16:23 -03:00
1 parent 0cfd02316f
commit 44fa8f0e21
2 files changed
+9 -16

No files matched your search

@@ -26,16 +26,8 @@ Template.userLogin.onCreated(() => {
Meteor.defer(() => displayComponent.$element.focus());
};
// Handle success and redirect the user
const successHandler = () => {
const currentRoute = Router.current();
const redirect = currentRoute.params.query.redirect;
const path = redirect ? decodeURI(redirect) : '/';
return Router.go(path);
};
// Call the login method
return OHIF.user.login(formData).then(successHandler).catch(errorHandler);
return OHIF.user.login(formData).catch(errorHandler);
}
};