Commit 0bc8440d authored by Filipa Lacerda's avatar Filipa Lacerda

Stop polling and fetch the table

parent 6c76e81b
...@@ -65,13 +65,13 @@ export default { ...@@ -65,13 +65,13 @@ export default {
updateTable() { updateTable() {
// Cancel ongoing request // Cancel ongoing request
if (this.isMakingRequest) { if (this.isMakingRequest) {
this.service.cancelationSource.cancel();
} }
// Stop polling // Stop polling
this.poll.stop(); this.poll.stop();
// make new request // make new request
this.fetchPipelines(); this.getPipelines();
// restart polling // restart polling
this.poll.restart(); this.poll.restart();
}, },
...@@ -79,10 +79,13 @@ export default { ...@@ -79,10 +79,13 @@ export default {
if (!this.isMakingRequest) { if (!this.isMakingRequest) {
this.isLoading = true; this.isLoading = true;
this.getPipelines();
}
},
getPipelines() {
this.service.getPipelines(this.requestData) this.service.getPipelines(this.requestData)
.then(response => this.successCallback(response)) .then(response => this.successCallback(response))
.catch(() => this.errorCallback()); .catch(() => this.errorCallback());
}
}, },
setCommonData(pipelines) { setCommonData(pipelines) {
this.store.storePipelines(pipelines); this.store.storePipelines(pipelines);
......
...@@ -19,8 +19,13 @@ export default class PipelinesService { ...@@ -19,8 +19,13 @@ export default class PipelinesService {
getPipelines(data = {}) { getPipelines(data = {}) {
const { scope, page } = data; const { scope, page } = data;
const CancelToken = axios.CancelToken;
this.cancelationSource = CancelToken.source();
return axios.get(this.endpoint, { return axios.get(this.endpoint, {
params: { scope, page }, params: { scope, page },
cancelToken: this.cancelationSource.token,
}); });
} }
......
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