Commit 27da17e2 authored by Lee Tickett's avatar Lee Tickett Committed by Clement Ho

Apply suggestion to...

Apply suggestion to ee/app/assets/javascripts/projects/settings_service_desk/services/service_desk_service.js
parent 70af7c65
......@@ -62,8 +62,7 @@ export default {
this.service
.fetchIncomingEmail()
.then(res => res.json())
.then(data => {
.then(({ data }) => {
const email = data.service_desk_address;
if (!email) {
throw new Error(__("Response didn't include `service_desk_address`"));
......@@ -90,8 +89,7 @@ export default {
this.service
.toggleServiceDesk(isChecked)
.then(res => res.json())
.then(data => {
.then(({ data }) => {
const email = data.service_desk_address;
if (isChecked && !email) {
throw new Error(__("Response didn't include `service_desk_address`"));
......
import Vue from 'vue';
import vueResource from 'vue-resource';
Vue.use(vueResource);
import axios from '~/lib/utils/axios_utils';
class ServiceDeskService {
constructor(endpoint) {
this.serviceDeskResource = Vue.resource(`${endpoint}`);
this.endpoint = endpoint;
}
fetchIncomingEmail() {
return this.serviceDeskResource.get();
return axios.get(this.endpoint);
}
toggleServiceDesk(enable) {
return this.serviceDeskResource.update({
service_desk_enabled: enable,
});
return axios.put(this.endpoint, { service_desk_enabled: enable });
}
}
......
---
title: Remove vue-resource from service_desk_service.js
merge_request: 16041
author: Lee Tickett
type: other
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment