Commit 2caf62d1 authored by Regis's avatar Regis

refactor

parent 5ed18942
......@@ -2,38 +2,30 @@
/* eslint-disable no-param-reassign */
((gl) => {
gl.PipelineStore = class {
fetchDataLoop(Vue) {
const goFetch = vue =>
this.$http.get(`/api/v3/projects/${this.scope}/pipelines`)
const goFetch = (that, vue) =>
that.$http.get(`/api/v3/projects/${that.scope}/pipelines`)
.then((response) => {
vue.set(this, 'pipelines', JSON.parse(response.body));
vue.set(that, 'pipelines', JSON.parse(response.body));
}, () => {
console.error('API Error for Pipelines');
});
gl.PipelineStore = class {
fetchDataLoop(Vue) {
setInterval(() => {
console.log('DID IT');
goFetch(Vue);
goFetch(this, Vue);
}, 30000);
}
fetchCommits(vue) {
const goFetch = vueSet =>
this.$http.get(`/api/v3/projects/${this.scope}/pipelines`)
.then((response) => {
vueSet.set(this, 'pipelines', JSON.parse(response.body));
}, () => {
console.error('API Error for Pipelines');
});
this.$http.get(`/api/v3/projects/${this.scope}/repository/commits`)
.then((response) => {
vue.set(this, 'commits', JSON.parse(response.body));
}, () => {
console.error('API Error for Pipelines');
})
.then(() => goFetch(vue));
.then(() => goFetch(this, vue));
}
};
})(window.gl || (window.gl = {}));
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