]> git.immae.eu Git - github/bastienwirtz/homer.git/commitdiff
Revert "Added url and apikey config options under proxy"
authorEvan Steinkerchner <esteinkerchner@gmail.com>
Wed, 27 Apr 2022 23:15:18 +0000 (19:15 -0400)
committerEvan Steinkerchner <esteinkerchner@gmail.com>
Wed, 27 Apr 2022 23:15:18 +0000 (19:15 -0400)
This reverts commit a2dfffab6892c6976fc8b880f75c314506259675.

src/mixins/service.js

index b47f756586a8f5f428bfa7d75ebd1ea8fde6dc14..abc708c9d326549aa74ab4ac330e92bd49f3ca3e 100644 (file)
@@ -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");