diff --git a/web/ASC.Web.Client/src/helpers/utils.js b/web/ASC.Web.Client/src/helpers/utils.js new file mode 100644 index 0000000000..ae8d90a910 --- /dev/null +++ b/web/ASC.Web.Client/src/helpers/utils.js @@ -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); + } +} \ No newline at end of file diff --git a/web/ASC.Web.Client/src/store/auth/actions.js b/web/ASC.Web.Client/src/store/auth/actions.js index e6ae9c3fae..d3ef10d668 100644 --- a/web/ASC.Web.Client/src/store/auth/actions.js +++ b/web/ASC.Web.Client/src/store/auth/actions.js @@ -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)