|
|
- "use strict";
- const common_vendor = require("../../common/vendor.js");
- const responseInterceptors = (vm) => {
- common_vendor.index.$uv.http.interceptors.response.use((response) => {
- var _a;
- const data = response.data;
- const custom = (_a = response.config) == null ? void 0 : _a.custom;
- if (data.code !== 200) {
- if (custom.toast !== false) {
- common_vendor.index.$uv.toast(data.message);
- }
- if (custom == null ? void 0 : custom.catch) {
- return Promise.reject(data);
- } else {
- return new Promise(() => {
- });
- }
- }
- return data.data || {};
- }, (response) => {
- return Promise.reject(response);
- });
- };
- exports.responseInterceptors = responseInterceptors;
|