aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/mixins
diff options
context:
space:
mode:
authorJames White <james@jmwhite.co.uk>2022-03-05 18:13:43 +0000
committerJames White <james@jmwhite.co.uk>2022-03-06 20:04:16 +0000
commit1340a8e6d024ee0460a4fd3c218397251e2ac86b (patch)
tree499044bb26a75c3659ddfed11cc0e8ecced86571 /src/mixins
parentba2c7c5c57c5fcf9009750faf3968a7a374ec7a3 (diff)
downloadhomer-1340a8e6d024ee0460a4fd3c218397251e2ac86b.tar.gz
homer-1340a8e6d024ee0460a4fd3c218397251e2ac86b.tar.zst
homer-1340a8e6d024ee0460a4fd3c218397251e2ac86b.zip
Check if path has data before adding /
Diffstat (limited to 'src/mixins')
-rw-r--r--src/mixins/service.js8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/mixins/service.js b/src/mixins/service.js
index 17fa6fc..abc708c 100644
--- a/src/mixins/service.js
+++ b/src/mixins/service.js
@@ -31,7 +31,13 @@ export default {
31 path = path.slice(1); 31 path = path.slice(1);
32 } 32 }
33 33
34 return fetch(`${this.endpoint}/${path}`, options).then((response) => { 34 let url = this.endpoint;
35
36 if (path) {
37 url = `${this.endpoint}/${path}`;
38 }
39
40 return fetch(url, options).then((response) => {
35 if (!response.ok) { 41 if (!response.ok) {
36 throw new Error("Not 2xx response"); 42 throw new Error("Not 2xx response");
37 } 43 }