@m.wang/fetch

0.1.7 • Public • Published

Welcome to @m.wang/fetch 👋

Version Promise based HTTP client for the quick app

安装

  • 安装 @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 wangmin2@meizu.com

Show your support

Give a ⭐️ if this project helped you!

Readme

Keywords

none

Package Sidebar

Install

npm i @m.wang/fetch

Weekly Downloads

1

Version

0.1.7

License

MIT

Unpacked Size

10.1 kB

Total Files

13

Last publish

Collaborators

  • xttnyw