Fix codestyle

This commit is contained in:
SleepWalker 2017-10-17 19:46:00 +03:00
parent f55700b4ff
commit d28337cb7f
2 changed files with 13 additions and 8 deletions

View File

@ -32,7 +32,7 @@ const changeContextSpringConfig = {stiffness: 500, damping: 20, precision: 0.5};
* (e.g. the panel with lower index will slide from left side, and with greater from right side)
*/
const contexts = [
['login', 'password', 'mfa', 'forgotPassword', 'recoverPassword'],
['login', 'password', 'forgotPassword', 'mfa', 'recoverPassword'],
['register', 'activation', 'resendActivation'],
['acceptRules'],
['chooseAccount', 'permissions']

View File

@ -46,6 +46,12 @@ export function redirect(url: string): () => Promise<*> {
});
}
const PASSWORD_REQUIRED = 'error.password_required';
const LOGIN_REQUIRED = 'error.login_required';
const ACTIVATION_REQUIRED = 'error.account_not_activated';
const TOTP_REQUIRED = 'error.totp_required';
export function login({
login = '',
password = '',
@ -57,11 +63,6 @@ export function login({
totp?: string,
rememberMe?: bool
}) {
const PASSWORD_REQUIRED = 'error.password_required';
const LOGIN_REQUIRED = 'error.login_required';
const ACTIVATION_REQUIRED = 'error.account_not_activated';
const TOTP_REQUIRED = 'error.totp_required';
return wrapInLoader((dispatch) =>
authentication.login(
{login, password, totp, rememberMe}
@ -86,8 +87,9 @@ export function login({
}
}
return validationErrorsHandler(dispatch)(resp);
return Promise.reject(resp);
})
.catch(validationErrorsHandler(dispatch))
);
}
@ -508,7 +510,10 @@ function authHandler(dispatch) {
});
}
function validationErrorsHandler(dispatch: (Function | Object) => void, repeatUrl?: string) {
function validationErrorsHandler(
dispatch: (Function | Object) => void,
repeatUrl?: string
) {
return (resp) => {
if (resp.errors) {
const firstError = Object.keys(resp.errors)[0];