https://github.com/licoy/logic-axios
a logic axios request encapsulation
https://github.com/licoy/logic-axios
axios easy http logic-axios request simple
Last synced: 7 months ago
JSON representation
a logic axios request encapsulation
- Host: GitHub
- URL: https://github.com/licoy/logic-axios
- Owner: Licoy
- License: mit
- Created: 2022-03-22T03:39:59.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2022-03-22T07:24:55.000Z (almost 4 years ago)
- Last Synced: 2025-06-01T20:55:59.784Z (8 months ago)
- Topics: axios, easy, http, logic-axios, request, simple
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/logic-axios
- Size: 13.7 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## 简介
一个基于业务思考封装的`axios`依赖包。
## 安装
### npm
```shell
npm i logic-axios
```
### yarn
```shell
yarn add logic-axios
```
## 使用
### 创建实例
```js
import {createLogicAxios} from "logic-axios";
const logicAxios = createLogicAxios('http://localhost:8080');
```
### 发起请求
```js
const {data} = await logicAxios.get("/user/info");
console.log(data)
```
### 分页查询
```js
const page = await logicAxios.page("/users", {page: 1, pageSize: 10});
console.log(page.records)
```
提示:分页的格式对应于`MybatisPlus`框架的分页响应结构,其定义为:[IPage.java](
https://github.com/baomidou/mybatis-plus/blob/3.0/mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/metadata/IPage.java)
## 开源协议
[MIT](LICENSE)