Use single source of truth for vue_resource_interceptor

This commit is contained in:
Filipa Lacerda 2017-01-28 18:37:02 +00:00
parent 037b4fe939
commit 9972f59f94
4 changed files with 6 additions and 13 deletions

View file

@ -13,7 +13,7 @@
//= require ./components/board
//= require ./components/board_sidebar
//= require ./components/new_list_dropdown
//= require ./vue_resource_interceptor
//= require vue_shared/vue_resource_interceptor
$(() => {
const $boardApp = document.getElementById('board-app');

View file

@ -1,10 +0,0 @@
/* eslint-disable func-names, prefer-arrow-callback, no-unused-vars */
/* global Vue */
Vue.http.interceptors.push((request, next) => {
Vue.activeResources = Vue.activeResources ? Vue.activeResources + 1 : 1;
next(function (response) {
Vue.activeResources -= 1;
});
});

View file

@ -2,7 +2,7 @@
/*= require vue_shared/components/commit */
/*= require vue_pagination/index */
/*= require vue-resource
/*= require boards/vue_resource_interceptor */
/*= require vue_shared/vue_resource_interceptor */
/*= require ./status.js.es6 */
/*= require ./store.js.es6 */
/*= require ./pipeline_url.js.es6 */

View file

@ -19,10 +19,13 @@
props: {
/**
* Stores the Pipelines to render.
* Object used to store the Pipelines to render.
* It's passed as a prop to allow different stores to use this Component.
* Different API calls can result in different responses, using a custom
* store allows us to use the same pipeline component.
*
* Note: All provided stores need to have a `storePipelines` method.
* Find a better way to do this.
*/
store: {
type: Object,