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

index.js « services « alerts_settings « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: c49992d4f57eb375afa6b8446f97b5528ee3b858 (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
32
33
34
35
36
/* eslint-disable @gitlab/require-i18n-strings */
import axios from '~/lib/utils/axios_utils';

export default {
  updateGenericKey({ endpoint, params }) {
    return axios.put(endpoint, params);
  },
  updatePrometheusKey({ endpoint }) {
    return axios.post(endpoint);
  },
  updateGenericActive({ endpoint, params }) {
    return axios.put(endpoint, params);
  },
  updatePrometheusActive({ endpoint, params: { token, config, url, redirect } }) {
    const data = new FormData();
    data.set('_method', 'put');
    data.set('authenticity_token', token);
    data.set('service[manual_configuration]', config);
    data.set('service[api_url]', url);
    data.set('redirect_to', redirect);

    return axios.post(endpoint, data, {
      headers: {
        'Content-Type': 'application/x-www-form-urlencoded',
      },
    });
  },
  updateTestAlert({ endpoint, data, authKey }) {
    return axios.post(endpoint, data, {
      headers: {
        'Content-Type': 'application/json',
        Authorization: `Bearer ${authKey}`,
      },
    });
  },
};