[Vuejs]-Service for progress bar in Vue

1👍

When setting up your VueApollo instance, you could pass a watchLoading hook that watches all queries:

const apolloProvider = new VueApollo({
  watchLoading (isLoading, countModifier) {
    loading += countModifier
    console.log('Global loading', loading, countModifier)
  },
  //...
})

The property is documented in Smart Query options:

watchLoading(isLoading, countModifier) is a hook called when the loading state of the query changes. The countModifier parameter is either equal to 1 when the query is loading, or -1 when the query is no longer loading.

👤tony19

Leave a comment