New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

track-pending-request

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

track-pending-request

Generate a vuex module to track async requests 'pending' status.

latest
Source
npmnpm
Version
1.0.1
Version published
Maintainers
1
Created
Source

track-pending-request

Generate a vuex module to track async requests 'pending' status.

When you send a request to one of the registered endpoints or receive a response from one of them, this package set the proper 'pending' state value through axios interceptors.

Installation

npm i track-pending-request --save

Usage

Example

register package

import trackPendingRequestInstall from 'track-pending-request'
import axios from 'your/axios-config/path'

const store = new Vuex.Store({ 
    modules: {
      //your store modules
    }
});

//You need to install the package with your axios instance and your vuex store.
//Optionally you can define the desired store namspace it should use (default is 'trackPendingRequest').
trackPendingRequestInstall({axios, store, /* 'desiredStoreNamesapce' */});

export default store;

axios-config

import axios from 'axios'

const instance = axios.create({
    //your config
});

instance.endpoints = {
    request1: '/xxx/endpoint1'
    request2: '/yyy/endpoint2'
    request3: '/endpoint3'
};

//You need to define a 'trackPendingRequest' property on your 
//axios instance with the endpoints you would like to track
instance.trackPendingRequest = [
    instance.endpoints.request1    //we would like to track pending status only for '/xxx/endpoint1' requests
];

export default instance;

vue component

...
computed: {
    isRequest1Pending() {
        return this.$store.getters['trackPendingRequest/xxxEndpoint1']();
    },
}
...

Keywords

pending requests

FAQs

Package last updated on 17 Feb 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts