fetch for restful api
npm i faiqu --save
import faiqu from 'faiqu'
faiqu('/api').params({id:1}).get().then(res=>{ console.log(res) })
- faiquInit.baseUrl(url:string)
If the parameters you passed in the faiqu method are ' http://xxxx ', the method does not take effect
- faiquInit.preMethod(Array< Function >)
- faiquInit.defaultData(data:{})
key:string=>value:Function
- faiquInit.defaultHeader(data:{})
default:{ 'Content-type': 'application/x-www-form-urlencoded' }
- faiquInit.defaultParams(data:{})
default:{credentials: 'include' }
- faiquInit.err_catch(param:Function)
This method only applies to the error in the faiqu object and the error in preMethod
- faiqu (url:string)
Initialize a faiqu object as the request url
- params(data:{})
- json ()
set requeset header 'Content-type'=>'application/json'
- headers(data:{})
- get()
- post ()
- put (id?:string)
- delete(id?:string)