summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/deploy_keys/service/index.js
diff options
context:
space:
mode:
authorPaul Slaughter <pslaughter@gitlab.com>2018-05-09 17:57:01 +0000
committerClement Ho <clemmakesapps@gmail.com>2018-05-09 17:57:01 +0000
commit0cc349f083b1436033608f4bec42dcd8d6c0d605 (patch)
tree13d211ac078e8125f10d8fde79213f1ba9db7380 /app/assets/javascripts/deploy_keys/service/index.js
parentf0a0da69d637c7d88a006ae02e570ec1c278349b (diff)
downloadgitlab-ce-0cc349f083b1436033608f4bec42dcd8d6c0d605.tar.gz
refactor "deploy_keys" to use axios
Diffstat (limited to 'app/assets/javascripts/deploy_keys/service/index.js')
-rw-r--r--app/assets/javascripts/deploy_keys/service/index.js33
1 files changed, 10 insertions, 23 deletions
diff --git a/app/assets/javascripts/deploy_keys/service/index.js b/app/assets/javascripts/deploy_keys/service/index.js
index 194e95e4fca..9dc3b21f6f6 100644
--- a/app/assets/javascripts/deploy_keys/service/index.js
+++ b/app/assets/javascripts/deploy_keys/service/index.js
@@ -1,37 +1,24 @@
-import Vue from 'vue';
-import VueResource from 'vue-resource';
-
-Vue.use(VueResource);
+import axios from '~/lib/utils/axios_utils';
export default class DeployKeysService {
constructor(endpoint) {
- this.endpoint = endpoint;
-
- this.resource = Vue.resource(
- `${this.endpoint}{/id}`,
- {},
- {
- enable: {
- method: 'PUT',
- url: `${this.endpoint}{/id}/enable`,
- },
- disable: {
- method: 'PUT',
- url: `${this.endpoint}{/id}/disable`,
- },
- },
- );
+ this.axios = axios.create({
+ baseURL: endpoint,
+ });
}
getKeys() {
- return this.resource.get().then(response => response.json());
+ return this.axios.get()
+ .then(response => response.data);
}
enableKey(id) {
- return this.resource.enable({ id }, {});
+ return this.axios.put(`${id}/enable`)
+ .then(response => response.data);
}
disableKey(id) {
- return this.resource.disable({ id }, {});
+ return this.axios.put(`${id}/disable`)
+ .then(response => response.data);
}
}