aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/mixins
diff options
context:
space:
mode:
authorBastien Wirtz <bastien.wirtz@gmail.com>2022-03-06 22:30:10 +0100
committerGitHub <noreply@github.com>2022-03-06 22:30:10 +0100
commitdb2a2af3a4664366257957400b9eaadf795808c2 (patch)
tree2f8c2cf679a71776ee673bda6d05be007df0478a /src/mixins
parent2ccadd578e35ea82b44b7855b723a3211d707e2e (diff)
parent1340a8e6d024ee0460a4fd3c218397251e2ac86b (diff)
downloadhomer-db2a2af3a4664366257957400b9eaadf795808c2.tar.gz
homer-db2a2af3a4664366257957400b9eaadf795808c2.tar.zst
homer-db2a2af3a4664366257957400b9eaadf795808c2.zip
Merge pull request #393 from jamesmacwhite/ping-endpoint-urls
Check if path has data before adding a trailing slash (/)
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 }