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 { ...@@ -62,8 +62,7 @@ export default {
this.service this.service
.fetchIncomingEmail() .fetchIncomingEmail()
.then(res => res.json()) .then(({ data }) => {
.then(data => {
const email = data.service_desk_address; const email = data.service_desk_address;
if (!email) { if (!email) {
throw new Error(__("Response didn't include `service_desk_address`")); throw new Error(__("Response didn't include `service_desk_address`"));
...@@ -90,8 +89,7 @@ export default { ...@@ -90,8 +89,7 @@ export default {
this.service this.service
.toggleServiceDesk(isChecked) .toggleServiceDesk(isChecked)
.then(res => res.json()) .then(({ data }) => {
.then(data => {
const email = data.service_desk_address; const email = data.service_desk_address;
if (isChecked && !email) { if (isChecked && !email) {
throw new Error(__("Response didn't include `service_desk_address`")); throw new Error(__("Response didn't include `service_desk_address`"));
......
import Vue from 'vue'; import axios from '~/lib/utils/axios_utils';
import vueResource from 'vue-resource';
Vue.use(vueResource);
class ServiceDeskService { class ServiceDeskService {
constructor(endpoint) { constructor(endpoint) {
this.serviceDeskResource = Vue.resource(`${endpoint}`); this.endpoint = endpoint;
} }
fetchIncomingEmail() { fetchIncomingEmail() {
return this.serviceDeskResource.get(); return axios.get(this.endpoint);
} }
toggleServiceDesk(enable) { toggleServiceDesk(enable) {
return this.serviceDeskResource.update({ return axios.put(this.endpoint, { service_desk_enabled: enable });
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