Manweill / swagger-axios-codegen

swagger client to use axios and typescript
MIT License
306 stars 83 forks source link

讨论一下 #87

Closed xxbld closed 4 years ago

xxbld commented 4 years ago

@Manweill

Manweill commented 4 years ago

@xxbld

serviceOptions.axios = instance

Or
```js
axios.defaults.timeout = 15000
axios.defaults.baseURL = apiHost

你可以说说看你的想法

xxbld commented 4 years ago

是swagger里面还有一层basePath,不是指 baseUrl

{"swagger":"2.0","host":"","basePath":"/userkey/pc"}
xxbld commented 4 years ago

对的,是我一下短路了,我用一个函数再包装一次umi-request就ok了

Manweill commented 4 years ago

是swagger里面还有一层basePath,不是指 baseUrl

{"swagger":"2.0","host":"","basePath":"/userkey/pc"}

那你的想法是

xxbld commented 4 years ago

那你的想法是

我不知道这个常遇到不,我现在的做法是为每个生成的ts文件创建了一个baserUrl+basePath的axios实例 image