泛微E10二开 前端Ecode拦截器

请求拦截器

java 复制代码
axios.interceptors.request.use((config) => {
  

  let { url, data } = config;  


     //拦截创建流程接口
     if(url == '/api/workflow/list/newflow/getNewFlowListData'){

        alert(JSON.stringify(config))

       //将真实接口地址,作为参数传递给后台
       data.realUrl = url;

       //将本次调用的接口,调整为二开发布的接口
       config.url = '/api/secondev/getNewFlowListData';
     }
   
  return config;
});

响应拦截器

javascript 复制代码
import axios from 'axios';

/**
 * 定义响应拦截
 * 可以给响应结果附加结果,也可以进行错误统一处理
 */
axios.interceptors.response.use((response) => {
  const { config, data } = response;
  const { url='' } = config||{};
  if(url.includes('/api/workflow/list/newflow/getNewFlowListData') && data?.code===200){


    alert(JSON.stringify(response.data.data.listData[0].workflowname))
      response.data.data.listData[0].workflowname='123'

    //执行相关操作
  }

  return response;
}, function (error) {
  console.info('接口请求出错啦', error);
  return Promise.reject(error);
});
相关推荐
用户059540174469 分钟前
LangChain Memory 测试踩坑实录:用 pytest 自动化回归对话记忆,我折腾了整整一个周末
前端·css
kyriewen26 分钟前
Claude Code后天起默认Auto模式了——我第一时间改了这6个设置
前端·ai编程·claude
风骏时光牛马1 小时前
智能赋能型AI办公一体化系统架构
前端
满栀5851 小时前
vue动态路由效果
前端·javascript·vue.js·前端框架·vue
土豆~2 小时前
文件名没后缀就打不开:前端文件预览的内容嗅探改造
前端·状态模式
Euato_Key2 小时前
全栈视野学习Cookie——理解 Cookie 的本质
前端
前端开发呀2 小时前
我的 AI 终端配置清单
前端
敲代码的玉米C3 小时前
测试一直在写你的真实数据根
前端·人工智能·架构
执子念的飞鱼3 小时前
File Viewer 进入 2K 节点后,我更在意这 3 条回归
前端·typescript