intervention-pages
Version:
16 lines (15 loc) • 664 B
JavaScript
import { sendRequest } from '@unicef-polymer/etools-ajax/etools-ajax-request';
import { getStore } from './redux-store-access';
import { formatServerErrorAsText } from '@unicef-polymer/etools-ajax/ajax-error-parser';
import { showToast } from '../common/actions';
export const _sendRequest = (etoolsReqConfig, _requestKey, _checkProgress) => {
return sendRequest(etoolsReqConfig, _requestKey, _checkProgress)
.then((response) => response)
.catch((error) => {
if (error.status === 401) {
// TODO
}
getStore().dispatch(showToast(formatServerErrorAsText(error)));
throw error;
});
};