租房小程序前端代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
738 B

6 months ago
  1. "use strict";
  2. const common_vendor = require("../../common/vendor.js");
  3. const responseInterceptors = (vm) => {
  4. common_vendor.index.$uv.http.interceptors.response.use((response) => {
  5. var _a;
  6. const data = response.data;
  7. const custom = (_a = response.config) == null ? void 0 : _a.custom;
  8. if (data.code !== 200) {
  9. if (custom.toast !== false) {
  10. common_vendor.index.$uv.toast(data.message);
  11. }
  12. if (custom == null ? void 0 : custom.catch) {
  13. return Promise.reject(data);
  14. } else {
  15. return new Promise(() => {
  16. });
  17. }
  18. }
  19. return data.data || {};
  20. }, (response) => {
  21. return Promise.reject(response);
  22. });
  23. };
  24. exports.responseInterceptors = responseInterceptors;