web: Client: Moved checkResponseError to utils.js;
This commit is contained in:
parent
7002fda837
commit
69855a8157
6
web/ASC.Web.Client/src/helpers/utils.js
Normal file
6
web/ASC.Web.Client/src/helpers/utils.js
Normal 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);
|
||||||
|
}
|
||||||
|
}
|
@ -1,5 +1,6 @@
|
|||||||
import * as api from '../services/api';
|
import * as api from '../services/api';
|
||||||
import setAuthorizationToken from '../services/setAuthorizationToken';
|
import setAuthorizationToken from '../services/setAuthorizationToken';
|
||||||
|
import { checkResponseError } from '../../helpers/utils';
|
||||||
|
|
||||||
export const LOGIN_POST = 'LOGIN_POST';
|
export const LOGIN_POST = 'LOGIN_POST';
|
||||||
export const SET_CURRENT_USER = 'SET_CURRENT_USER';
|
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) {
|
export function changePassword(userId, password, key) {
|
||||||
return dispatch => {
|
return dispatch => {
|
||||||
return api.changePassword(userId, password, key)
|
return api.changePassword(userId, password, key)
|
||||||
|
Loading…
Reference in New Issue
Block a user