Vuex xhr state
Use Vuex to manage the state of you're ajax calls.
- Keep data from ajax calls in your Vuex store
- Track the state of an individual network load calls in your Vuex store
- Only fetch data when needed and not already fetching
This package is still in development.
instalation
npm
npm install vuex-xhr-state
yarn
yarn add vuex-xhr-state
Example
Could be outdated and incomplete feel free to ask questions on gitter (ricky-rick) or e-mail
Store module file logs/index.js
const xhrLogList = { return api } default: cache: true store: ... const logs = 'logs' xhrLogList
Store
Vue const xhrPlugins = logs Vuex
Component
computed: ... { return xhrLogList } methods: ... { this /** * or with custom error handling * if the closure returns true the error will not apear in the global VXS store */ const errorHandlererror => return true ) this }