# @edu-fe/api

> Axios based client for edu-fe team

Latest version **1.2.0** (published 2019-03-19) · 0 weekly downloads

## Install

```sh
npm install @edu-fe/api
pnpm add @edu-fe/api
yarn add @edu-fe/api
bun add @edu-fe/api
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.0 |
| Published | 2019-03-19 |
| First published | 2018-05-07 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 6 |
| Unpacked size | 5.6 KB |
| Known vulnerabilities | 0 (+24 in 1 direct dependencies) |
| Install scripts | no |
| Author | muming |
| Maintainers | anothersaber, ccforeverd, hungryyang, liuchao10, mutu, shockw4ver |

## Links

- npm: https://www.npmjs.com/package/@edu-fe/api
- Repository: https://git.iciba.com:2222/npm/api
- npm.io page: https://npm.io/package/@edu-fe/api

## Dependencies (6)

- [axios](https://npm.io/package/axios.md) ^0.18.0
- [@edu-fe/os](https://npm.io/package/@edu-fe/os.md) latest
- [lodash.keys](https://npm.io/package/lodash.keys.md) ^4.2.0
- [lodash.merge](https://npm.io/package/lodash.merge.md) ^4.6.1
- [lodash.assign](https://npm.io/package/lodash.assign.md) ^4.2.0
- [lodash.topairs](https://npm.io/package/lodash.topairs.md) ^4.3.0

## Recent versions

- 1.2.0 (latest) — 2019-03-19
- 1.1.6 — 2019-03-19
- 1.1.5 — 2018-08-24
- 1.1.4 — 2018-06-08
- 1.1.3 — 2018-06-08
- 1.1.2 — 2018-06-08
- 1.1.1 — 2018-06-07
- 1.1.0 — 2018-06-07
- 1.0.6 — 2018-06-01
- 1.0.5 — 2018-06-01
- 1.0.4 — 2018-05-31
- 1.0.3 — 2018-05-31
- 1.0.2 — 2018-05-29
- 1.0.1 — 2018-05-28
- 1.0.0 — 2018-05-28
- … 18 more at https://npm.io/package/@edu-fe/api/versions

## README

## @edu-fe/api

Axios based client for edu-fe team

## Installing

Using npm:

```shell
$ npm i @edu-fe/api
```

Using yarn:

```shell
$ yarn add @edu-fe/api
```

## Dependencies

非小程序内使用**Axios**

小程序内调用**wx.request**

## Api

### create

api.create(url, [options])

返回**Promise**对象

### create options

```javascript
{
	// 是否缓存相应数据
	// 若使用缓存，则不会再次请求
	cache: fasle,
	
	// 是否需要校验登录状态
	// 如果需要登录，会调用前置登录方法
	checkLogin: false,
	
	// 是否需要发送formData
	// 尽在POST请求时可用
	formData: false,

    // baseURL
    baseURL: 'https://dynamicedu.wps.cn/API_V2'
	
	// 任何axios可用的选项
	...
}
```

### createModule

api.createModule(module, [name])

未传入name，则注册到common组中

## 错误处理

请求发生异常时会返回状态为**rejected**的Promise对象，需要在调用时catch


## Example

```javascript
import api from '@edu-fe/api'

const module = {
	request: api.create('/')
}
api.createModule(module, 'example')
api.example.request()
	.then(res => {
		// TODO:
	})
	.catch(err => {
		// handle error
	})
```

---
_Source: https://npm.io/package/@edu-fe/api · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
