gitlab-org--gitlab-foss/app/assets/javascripts/cycle_analytics/cycle_analytics_service.js

31 lines
691 B
JavaScript
Raw Normal View History

import Vue from 'vue';
import VueResource from 'vue-resource';
2016-10-20 04:34:16 +00:00
Vue.use(VueResource);
2016-10-20 04:34:16 +00:00
export default class CycleAnalyticsService {
constructor(options) {
this.requestPath = options.requestPath;
this.cycleAnalytics = Vue.resource(this.requestPath);
}
fetchCycleAnalyticsData(options = { startDate: 30 }) {
return this.cycleAnalytics.get({ cycle_analytics: { start_date: options.startDate } });
}
fetchStageData(options) {
const {
stage,
startDate,
} = options;
return Vue.http.get(`${this.requestPath}/events/${stage.name}.json`, {
params: {
cycle_analytics: {
start_date: startDate,
},
},
});
2016-11-19 00:38:29 +00:00
}
}