vue-ajax-intercept

1.0.4 • Public • Published

A tiny vueJS plugin to intercept every ajax request.

The component intercept every ajax requisition, it doesn't matter which component you use [Axios, Vue-resourse, vanilla JS or any other].

With that you can implement any kind of control you need, validate users, control progress, or give an easy feedback for the users.

Requirements

Installation

$ npm install vue-ajax-intercept --save

Usage

<script>
import ajaxIntercept from 'vue-ajax-intercept'
 
export default {
  name: 'app',
  methods: {
    start(status){
      console.log(status); //XMLHttpRequest object
    },
    finish(status){
      console.log(status); //XMLHttpRequest object
    }
  },
  components: { ajaxIntercept }
}
 
</script>
<template>
  <div>
    <ajax-intercept @start="start" @finish="finish" ></ajax-intercept>  
    <router-view></router-view>
  </div>
</template>

License

The MIT License

Package Sidebar

Install

npm i vue-ajax-intercept

Weekly Downloads

23

Version

1.0.4

License

MIT

Last publish

Collaborators

  • vanderleisilva