Code Monkey home page Code Monkey logo

big-axios's Introduction

big-axios npm

一个基于 axios 的网络请求库。big-axios 内置了常见的请求拦截器、响应拦截器以及支持请求错误的日志输出。

big-axios 是通过未经转译的 ts 文件进行发布的,需要与用户项目本身一同编译构建。

特性

1、内置常见的请求拦截器、响应拦截器。 2、支持请求错误的日志在浏览器控制台输出。 3、对文件流进行封装。

用法

0、环境支持

Edge Firefox Chrome Safari
Edge ≥ 79 Firefox ≥ 78 Chrome ≥ 64 Safari ≥ 12

1、安装

npm install big-axios

2、快速上手

import request from "big-axios";

request.get("/api/user").then(res => {})

2.1 概念

serviceApiErrorMsgs: 服务端返回的错误信息。其值格式为:{ 400: { msg: "请求失败" } } extraOptions: 非 axios 本身的配置项。其默认值为:{ loginPath = '/login', successfulCodes = [200, 0, '200'] },其中 loginPath 为权限验证未通过时跳转到登录页面的登录页面 url,successfulCodes 为服务端 api 返回的业务状态码。

big-axios's People

Contributors

wangzl1163 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.