diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2018-10-08 16:26:54 +0300 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2018-10-08 16:26:54 +0300 |
commit | c5c576adddaec082b2228e9b0beb29c783a04d51 (patch) | |
tree | 18cb10851e884a199eca72ea068f9e68af56dda6 /settings/src | |
parent | 8110a3be699bbdea96df30472dce7862e0964901 (diff) |
Replace hand-crafted request token logic by nextcloud-axios lib
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'settings/src')
-rw-r--r-- | settings/src/store/api.js | 15 | ||||
-rw-r--r-- | settings/src/store/apps.js | 1 |
2 files changed, 6 insertions, 10 deletions
diff --git a/settings/src/store/api.js b/settings/src/store/api.js index 8fc4dfde3e6..e87dabd4931 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,27 +91,27 @@ export default { }); }, get(url) { - return axios.get(sanitize(url), tokenHeaders) + return axios.get(sanitize(url)) .then((response) => Promise.resolve(response)) .catch((error) => Promise.reject(error)); }, post(url, data) { - return axios.post(sanitize(url), data, tokenHeaders) + return axios.post(sanitize(url), data) .then((response) => Promise.resolve(response)) .catch((error) => Promise.reject(error)); }, patch(url, data) { - return axios.patch(sanitize(url), data, tokenHeaders) + return axios.patch(sanitize(url), data) .then((response) => Promise.resolve(response)) .catch((error) => Promise.reject(error)); }, put(url, data) { - return axios.put(sanitize(url), data, tokenHeaders) + return axios.put(sanitize(url), data) .then((response) => Promise.resolve(response)) .catch((error) => Promise.reject(error)); }, delete(url, data) { - return axios.delete(sanitize(url), { data: data, headers: tokenHeaders.headers }) + return axios.delete(sanitize(url), { data: data }) .then((response) => Promise.resolve(response)) .catch((error) => Promise.reject(error)); } 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 = { |