From d48fc7ca2625b7e645ed0ab9b349bfc1876016aa Mon Sep 17 00:00:00 2001 From: Evan Steinkerchner Date: Wed, 27 Apr 2022 19:15:18 -0400 Subject: Revert "Added url and apikey config options under proxy" This reverts commit a2dfffab6892c6976fc8b880f75c314506259675. --- src/mixins/service.js | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) (limited to 'src/mixins') 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"); -- cgit v1.2.3