web: Client: Added more checkResponseError call

This commit is contained in:
Alexey Safronov 2019-10-04 11:20:08 +03:00
parent 69855a8157
commit 24a4e5456c

View File

@ -75,20 +75,34 @@ export function setNewEmail(email) {
};
};
export function getUser(dispatch) {
return api.getUser()
.then((res) => {
checkResponseError(res);
return dispatch(setCurrentUser(res.data.response));
});
}
export function getPortalSettings(dispatch) {
return api.getSettings()
.then(res => {
checkResponseError(res);
return dispatch(setSettings(res.data.response))
return dispatch(setSettings(res.data.response));
});
}
export function getModules(dispatch) {
return api.getModulesList()
.then(res => {
checkResponseError(res);
return dispatch(setModules(res.data.response));
});
}
export function getUserInfo(dispatch) {
return api.getUser()
.then((res) => dispatch(setCurrentUser(res.data.response)))
.then(() => getPortalSettings(dispatch))
.then(api.getModulesList)
.then((res) => dispatch(setModules(res.data.response)))
return getUser(dispatch)
.then(getPortalSettings.bind(this, dispatch))
.then(getModules.bind(this, dispatch))
.then(() => dispatch(setIsLoaded(true)));
};