1.0.9 • Published 4 months ago

@monsterooo/http v1.0.9

Weekly downloads
-
License
ISC
Repository
-
Last release
4 months ago

title: Http 数据请求 sidemenu: false nav: title: 数据请求 path: /http

order: 3

Http

基于 axios 二次封装的 Http 类。

代码演示

import createHttp from '@monsterooo/http';

const http = createHttp({
  domain: 'http://api.thunderfost.com',
});

const adminHttp = createHttp({
  domain: 'http://api.admin.thunderfost.com',
});

const request = adminHttp();

createHttp

API

参数说明类型默认值
domain请求域string-
isSuccess判断数据是否请求成功(data) => boolean-

http

参数说明类型默认值
domain请求域string-
url请求地址,可以为全路径string-
method请求方式stringget
data请求参数any-
filterEmptyParam是否过滤为空的参数booleantrue
onUnauthorizedsession 失效回调function-
...others参考 axios--