1.1.9 • Published 3 years ago

@kiter/axios v1.1.9

Weekly downloads
-
License
MIT
Repository
-
Last release
3 years ago

Axios 请求库二次封装支持 get、post、put、patch、delete

response 拦截 HttpCode 异常 console.error 输出

使用方法

import request, { configure, instance } from '@kiter/axios'

# configure 配置
configure({
  beforeRequest: (data) => {
    data['uid'] = localStorage.getItem('uid')
    data['token'] = localStorage.getItem('token')
    data['bodyType'] = 'formData' // 设置 bodyType = formData 后,所有数据会以 application/x-www-form-urlencoded 请求头进行提交
  },
  onError: (err) => {
    console.error(error)
  }
})

# instance 设置axios实例的 instance
instance.defaults.baseURL = ''
instance.defaults.timeout = 2500

# 发起请求,请求返回
const response = await request.post('demo/index')({
  page: 1,
  pageSize: 10
})
1.1.9

3 years ago

1.1.8

3 years ago

1.1.7

4 years ago

1.1.6

4 years ago

1.1.5

4 years ago

1.1.1

4 years ago

1.0.19

4 years ago

1.1.0

4 years ago

1.0.18

4 years ago

1.0.17

4 years ago

1.0.16

4 years ago

1.1.4

4 years ago

1.1.3

4 years ago

1.1.2

4 years ago

1.0.22

4 years ago

1.0.21

4 years ago

1.0.20

4 years ago

1.0.24

4 years ago

1.0.23

4 years ago

1.0.15

4 years ago

1.0.14

4 years ago

1.0.13

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.11

4 years ago

1.0.10

4 years ago

1.0.12

4 years ago

1.0.0

4 years ago