1.0.3 • Published 6 years ago

react-native-httol v1.0.3

Weekly downloads
1
License
ISC
Repository
github
Last release
6 years ago

react-native-httol

Installation

Since the library is a JS-based solution, to install the latest version of react-native-httol you only need to run:

yarn add react-native-httol

or

npm install react-native-httol

Functions

  1. 网络相关

- fetchType

fetchType.get   //get请求
fetchType.post  //post请求

- fetchBase

fetchBase(url, ...props).then(json=>{
    // json 接口返回的数据
});

//props方法可以传入fetch的剩余属性
//例如
fetch("https://mywebsite.com/endpoint/", {
  method: "POST",
  headers: {
    Accept: "application/json",
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    firstParam: "yourValue",
    secondParam: "yourOtherValue"
  })
});