Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cycle_analytics_service.js « cycle_analytics « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: a0426301a0afc9eed95a28a4476fedea1b5a2a73 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import axios from '~/lib/utils/axios_utils';

export default class CycleAnalyticsService {
  constructor(options) {
    this.axios = axios.create({
      baseURL: options.requestPath,
    });
  }

  fetchCycleAnalyticsData(options = { startDate: 30 }) {
    return this.axios
      .get('', {
        params: {
          'cycle_analytics[start_date]': options.startDate,
        },
      })
      .then(x => x.data);
  }

  fetchStageData(options) {
    const { stage, startDate } = options;

    return this.axios
      .get(`events/${stage.name}.json`, {
        params: {
          'cycle_analytics[start_date]': startDate,
        },
      })
      .then(x => x.data);
  }
}