X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=src%2Fmixins%2Fservice.js;h=abc708c9d326549aa74ab4ac330e92bd49f3ca3e;hb=585844394d7a4cc4a58e30fd42cb1f8e83ac02f7;hp=17fa6fcc95600f955a55014d878285f1a7c45a4f;hpb=87aadbb6df26009e93ee20752184300819d833e8;p=github%2Fbastienwirtz%2Fhomer.git 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 { path = path.slice(1); } - return fetch(`${this.endpoint}/${path}`, options).then((response) => { + let url = this.endpoint; + + if (path) { + url = `${this.endpoint}/${path}`; + } + + return fetch(url, options).then((response) => { if (!response.ok) { throw new Error("Not 2xx response"); }