fixed issue with axios_utils not reducing activeVueResources variable when request fails

This commit is contained in:
Phil Hughes 2018-02-02 10:05:37 +00:00
parent 135a02cf42
commit 645d635976
No known key found for this signature in database
GPG Key ID: 32245528C52E0F9F
2 changed files with 16 additions and 1 deletions

View File

@ -9,6 +9,7 @@ export default class Job {
constructor(options) {
this.timeout = null;
this.state = null;
this.fetchingStatusFavicon = false;
this.options = options || $('.js-build-options').data();
this.pagePath = this.options.pagePath;
@ -178,7 +179,17 @@ export default class Job {
.then((res) => {
const log = res.data;
setCiStatusFavicon(`${this.pagePath}/status.json`);
if (!this.fetchingStatusFavicon) {
this.fetchingStatusFavicon = true;
setCiStatusFavicon(`${this.pagePath}/status.json`)
.then(() => {
this.fetchingStatusFavicon = false;
})
.catch(() => {
this.fetchingStatusFavicon = false;
});
}
if (log.state) {
this.state = log.state;

View File

@ -19,6 +19,10 @@ axios.interceptors.response.use((config) => {
window.activeVueResources -= 1;
return config;
}, (e) => {
window.activeVueResources -= 1;
return Promise.reject(e);
});
export default axios;