@m.wang/fetch
v0.1.7
Published
Promise based HTTP client for the quick app
Downloads
8
Readme
安装
- 安装 @m.wang/fetch
npm install @m.wang/fetch
- 添加接口权限
"features": [
{ "name": "system.fetch"},
{"name": "system.prompt"},
]
案例
import fetch from "@m.wang/fetch"
fetch("http://domain?paramA=example")
.then( function(response){
console.log("success")
},
function(){
console.log("fail")
})
配置
fetch.defaults.baseUrl="http://domain/"
fetch.defaults.responseType='text'
fetch.defaults.timeOut = 30*1000
// 其它参数请参考 :https://doc.quickapp.cn/features/system/fetch.html
API
fetch.get(url, params, config)
fetch.post(url, data, config)
拦截器
fetch.requestUse(fulfilled, rejected)
fetch.responseUse(fulfilled, rejected)
Author
👤 M.Wang [email protected]
Show your support
Give a ⭐️ if this project helped you!