summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/projects/settings_service_desk/services/service_desk_service.js
blob: d707763c64ea7e2ce2a7873f6ebd23b8599d0cf0 (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
import axios from '~/lib/utils/axios_utils';

class ServiceDeskService {
  constructor(endpoint) {
    this.endpoint = endpoint;
  }

  fetchIncomingEmail() {
    return axios.get(this.endpoint);
  }

  toggleServiceDesk(enable) {
    return axios.put(this.endpoint, { service_desk_enabled: enable });
  }

  updateTemplate({ selectedTemplate, outgoingName, projectKey = '' }, isEnabled) {
    const body = {
      issue_template_key: selectedTemplate,
      outgoing_name: outgoingName,
      project_key: projectKey,
      service_desk_enabled: isEnabled,
    };
    return axios.put(this.endpoint, body);
  }
}

export default ServiceDeskService;