UNPKG

@choerodon/master

Version:
21 lines (17 loc) 674 B
import get from 'lodash/get'; import { prompt } from "../../../utils"; import { AXIOS_TYPE_DEFAULT } from "../CONSTANTS"; export default function handleResponseInterceptor(response) { var resData = get(response, 'data'); var config = get(response, 'config') || {}; if (get(response, 'status') === 204) { return response; } if (resData === null || resData === void 0 ? void 0 : resData.failed) { if (config.application === AXIOS_TYPE_DEFAULT && !(config === null || config === void 0 ? void 0 : config.noPrompt)) { prompt(resData === null || resData === void 0 ? void 0 : resData.message, 'error'); } throw resData; } return resData; }