diff options
Diffstat (limited to 'settings/src')
-rw-r--r-- | settings/src/store/api.js | 25 | ||||
-rw-r--r-- | settings/src/store/apps.js | 1 |
2 files changed, 6 insertions, 20 deletions
diff --git a/settings/src/store/api.js b/settings/src/store/api.js index 8fc4dfde3e6..5bab785d94b 100644 --- a/settings/src/store/api.js +++ b/settings/src/store/api.js @@ -20,10 +20,7 @@ * */ -import axios from 'axios'; - -const requestToken = document.getElementsByTagName('head')[0].getAttribute('data-requesttoken'); -const tokenHeaders = { headers: { requesttoken: requestToken } }; +import axios from 'nextcloud-axios' const sanitize = function(url) { return url.replace(/\/$/, ''); // Remove last url slash @@ -94,28 +91,18 @@ export default { }); }, get(url) { - return axios.get(sanitize(url), tokenHeaders) - .then((response) => Promise.resolve(response)) - .catch((error) => Promise.reject(error)); + return axios.get(sanitize(url)); }, post(url, data) { - return axios.post(sanitize(url), data, tokenHeaders) - .then((response) => Promise.resolve(response)) - .catch((error) => Promise.reject(error)); + return axios.post(sanitize(url), data); }, patch(url, data) { - return axios.patch(sanitize(url), data, tokenHeaders) - .then((response) => Promise.resolve(response)) - .catch((error) => Promise.reject(error)); + return axios.patch(sanitize(url), data); }, put(url, data) { - return axios.put(sanitize(url), data, tokenHeaders) - .then((response) => Promise.resolve(response)) - .catch((error) => Promise.reject(error)); + return axios.put(sanitize(url), data); }, delete(url, data) { - return axios.delete(sanitize(url), { data: data, headers: tokenHeaders.headers }) - .then((response) => Promise.resolve(response)) - .catch((error) => Promise.reject(error)); + return axios.delete(sanitize(url), { data: data }); } };
\ No newline at end of file diff --git a/settings/src/store/apps.js b/settings/src/store/apps.js index 99bd4af4595..287a1c13505 100644 --- a/settings/src/store/apps.js +++ b/settings/src/store/apps.js @@ -21,7 +21,6 @@ */ import api from './api'; -import axios from 'axios/index'; import Vue from 'vue'; const state = { |