A tiny vueJS plugin to intercept every ajax request
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
dist
src
.babelrc
.editorconfig
.gitignore
README.md
build.js
package-lock.json
package.json

README.md

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