web: Client: Moved checkResponseError to utils.js;

This commit is contained in:
Alexey Safronov 2019-10-04 10:49:38 +03:00
parent 7002fda837
commit 69855a8157
2 changed files with 7 additions and 7 deletions

View File

@ -0,0 +1,6 @@
export function checkResponseError(res) {
if (res && res.data && res.data.error) {
console.error(res.data.error);
throw new Error(res.data.error.message);
}
}

View File

@ -1,5 +1,6 @@
import * as api from '../services/api';
import setAuthorizationToken from '../services/setAuthorizationToken';
import { checkResponseError } from '../../helpers/utils';
export const LOGIN_POST = 'LOGIN_POST';
export const SET_CURRENT_USER = 'SET_CURRENT_USER';
@ -138,13 +139,6 @@ export function createConfirmUser(registerData, loginData, key) {
};
};
export function checkResponseError(res) {
if (res && res.data && res.data.error) {
console.error(res.data.error);
throw new Error(res.data.error.message);
}
}
export function changePassword(userId, password, key) {
return dispatch => {
return api.changePassword(userId, password, key)