Giter Site home page Giter Site logo

axios-async's Introduction

Usage

Install the library

npm install findmory/async-axios

Import it into your app

import axiosPlus from 'async-axios`

Setup Config object

let config = {

  /* url is mandatory */
  url: <string>,

  /* if no method, default is 'get' */
  method: <'get', 'post', etc>,

  /* data body for 'post', 'put', etc */
  data: {},

  /* timeout in milleseconds */
  timeout: <number>,

  /* retry delay in milleseconds */
  retryDelay: <number>,

  /* retry type.  one of;
    'static' (retryDelay = retryDelay)
    'linear' (retryDelay = # retries * retryDelay)
    'exponential (retryDelay = ((Math.pow(2, config.currentRetryAttempt) - 1) / 2) * 1000;)'
  */
  retryType: <string>,

  /* number of times to retry (-1: forever, 0: none)
  */
  retries: <integer>,

  /* callback to run during retry */
  retryCallback: <function>,

  /* Explicit Success Codes. List of resp codes to consider success */
  successCodes: <array>

}

Make the request

let resp = axiosPlus(config); // returns resp or `false`

axios-async's People

Contributors

findmory avatar

Stargazers

 avatar

Watchers

 avatar  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.