debian-mirror-gitlab/app/assets/javascripts/cycle_analytics/cycle_analytics_service.js
2018-03-17 18:26:18 +05:30

30 lines
691 B
JavaScript

import Vue from 'vue';
import VueResource from 'vue-resource';
Vue.use(VueResource);
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,
},
},
});
}
}