tuax / tua-api

🏗 一款可配置的通用 api 请求函数生成工具(A common tool helps converting configs to api functions)

Home Page:https://tuax.github.io/tua-api/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

feat: support pass configs by second parameter

BuptStEve opened this issue · comments

你的功能请求是否与某些问题相关?请描述
现在各种配置只能在文件里静态地配置,在使用上还是不够灵活。

例如 axios 的配置参数,headers 等,需要在调用接口时,一起传递。

描述您想要的解决方案
希望在发起请求的第二个参数传递配置。

fooApi.bar(
  { a: 1 }, // 第一个参数传的还是接口参数 
  { axiosOptions: { ... } } // 第二个参数传配置
)

描述你考虑过的备选方案
虽然目前可以借助中间件实现,但在实际使用上还是有点儿繁琐。