Commit 2caf62d1 authored by Regis's avatar Regis

refactor

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