Commit 9ebe4524 authored by Filipa Lacerda's avatar Filipa Lacerda

Improve fetching mechanism

parent 68b6e89e
...@@ -71,6 +71,8 @@ module.exports = Vue.component('deploy_boards_components', { ...@@ -71,6 +71,8 @@ module.exports = Vue.component('deploy_boards_components', {
if (this.backOffRequestCounter < 3) { if (this.backOffRequestCounter < 3) {
next(); next();
} else {
stop(resp);
} }
} else { } else {
stop(resp); stop(resp);
...@@ -78,21 +80,20 @@ module.exports = Vue.component('deploy_boards_components', { ...@@ -78,21 +80,20 @@ module.exports = Vue.component('deploy_boards_components', {
}) })
.catch(stop); .catch(stop);
}, Infinity) }, Infinity)
.then(resp => resp.json()) .then((resp) => {
.then((response) => { if (resp.status === 204) {
if (!Object.keys(response).length && this.backOffRequestCounter === 3) {
this.hasError = true; this.hasError = true;
return resp;
} }
return resp.json();
})
.then((response) => {
this.store.storeDeployBoard(this.environmentID, response); this.store.storeDeployBoard(this.environmentID, response);
return response; return response;
}) })
.then((response) => { .then(() => {
if ((!Object.keys(response).length && this.isLoading = false;
this.backOffRequestCounter === 3) ||
Object.keys(response).length) {
this.isLoading = false;
}
}) })
.catch(() => { .catch(() => {
this.isLoading = false; this.isLoading = false;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment