aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/mixins
diff options
context:
space:
mode:
authorBastien Wirtz <bastien.wirtz@gmail.com>2021-10-10 10:37:20 +0200
committerBastien Wirtz <bastien.wirtz@gmail.com>2021-10-10 10:37:20 +0200
commit2fba043575e6a8db94434986c1781d2716c8f6d4 (patch)
tree636929cc74f164d9cbe2f8db3eee6c1d0806cffd /src/mixins
parentefc2bbb85673fb269e75d64655e433bed90a995a (diff)
downloadhomer-2fba043575e6a8db94434986c1781d2716c8f6d4.tar.gz
homer-2fba043575e6a8db94434986c1781d2716c8f6d4.tar.zst
homer-2fba043575e6a8db94434986c1781d2716c8f6d4.zip
Allow non json reponse in fetch.
Diffstat (limited to 'src/mixins')
-rw-r--r--src/mixins/service.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/mixins/service.js b/src/mixins/service.js
index ae23a27..17fa6fc 100644
--- a/src/mixins/service.js
+++ b/src/mixins/service.js
@@ -12,7 +12,7 @@ export default {
12 } 12 }
13 }, 13 },
14 methods: { 14 methods: {
15 fetch: function (path, init) { 15 fetch: function (path, init, json = true) {
16 let options = {}; 16 let options = {};
17 17
18 if (this.proxy?.useCredentials) { 18 if (this.proxy?.useCredentials) {
@@ -35,7 +35,8 @@ export default {
35 if (!response.ok) { 35 if (!response.ok) {
36 throw new Error("Not 2xx response"); 36 throw new Error("Not 2xx response");
37 } 37 }
38 return response.json(); 38
39 return json ? response.json() : response;
39 }); 40 });
40 }, 41 },
41 }, 42 },