From: Evan Steinkerchner Date: Wed, 27 Apr 2022 23:15:18 +0000 (-0400) Subject: Revert "Added url and apikey config options under proxy" X-Git-Url: https://git.immae.eu/?a=commitdiff_plain;h=d48fc7ca2625b7e645ed0ab9b349bfc1876016aa;p=github%2Fbastienwirtz%2Fhomer.git Revert "Added url and apikey config options under proxy" This reverts commit a2dfffab6892c6976fc8b880f75c314506259675. --- diff --git a/src/mixins/service.js b/src/mixins/service.js index b47f756..abc708c 100644 --- a/src/mixins/service.js +++ b/src/mixins/service.js @@ -1,5 +1,3 @@ -const merge = require("lodash.merge"); - export default { props: { proxy: Object, @@ -27,28 +25,18 @@ export default { this.item.useCredentials === true ? "include" : "omit"; } - if (this.proxy?.apikey) { - options.headers = { - "X-Homer-Api-Key": this.proxy.apikey, - }; - } + options = Object.assign(options, init); if (path.startsWith("/")) { path = path.slice(1); } - let url = path ? `${this.endpoint}/${path}` : this.endpoint; + let url = this.endpoint; - if (this.proxy?.url) { - options.headers = { - ...(options.headers || {}), - "X-Homer-Api-Url": url, - }; - url = this.proxy.url; + if (path) { + url = `${this.endpoint}/${path}`; } - options = merge(options, init); - return fetch(url, options).then((response) => { if (!response.ok) { throw new Error("Not 2xx response");