aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/mixins/service.js
diff options
context:
space:
mode:
authorEvan Steinkerchner <esteinkerchner@gmail.com>2022-04-19 20:24:51 -0400
committerEvan Steinkerchner <esteinkerchner@gmail.com>2022-04-19 20:24:51 -0400
commit240e3f0e87e4afd0bb6716374cd3a408775c2950 (patch)
treef4b9ea37eff956218ae5c36a78fe3f6535c1846a /src/mixins/service.js
parent33f75a798a204e2e7fbecb42571ed007092718c2 (diff)
downloadhomer-240e3f0e87e4afd0bb6716374cd3a408775c2950.tar.gz
homer-240e3f0e87e4afd0bb6716374cd3a408775c2950.tar.zst
homer-240e3f0e87e4afd0bb6716374cd3a408775c2950.zip
Changed config and header names as per @bastienwirtz feedback
Diffstat (limited to 'src/mixins/service.js')
-rw-r--r--src/mixins/service.js11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/mixins/service.js b/src/mixins/service.js
index b47f756..b8c2cdc 100644
--- a/src/mixins/service.js
+++ b/src/mixins/service.js
@@ -3,6 +3,7 @@ const merge = require("lodash.merge");
3export default { 3export default {
4 props: { 4 props: {
5 proxy: Object, 5 proxy: Object,
6 forwarder: Object,
6 }, 7 },
7 created: function () { 8 created: function () {
8 // custom service often consume info from an API using the item link (url) as a base url, 9 // custom service often consume info from an API using the item link (url) as a base url,
@@ -27,9 +28,9 @@ export default {
27 this.item.useCredentials === true ? "include" : "omit"; 28 this.item.useCredentials === true ? "include" : "omit";
28 } 29 }
29 30
30 if (this.proxy?.apikey) { 31 if (this.forwarder?.apikey) {
31 options.headers = { 32 options.headers = {
32 "X-Homer-Api-Key": this.proxy.apikey, 33 "X-Homer-Forwarder-Api-Key": this.forwarder.apikey,
33 }; 34 };
34 } 35 }
35 36
@@ -39,12 +40,12 @@ export default {
39 40
40 let url = path ? `${this.endpoint}/${path}` : this.endpoint; 41 let url = path ? `${this.endpoint}/${path}` : this.endpoint;
41 42
42 if (this.proxy?.url) { 43 if (this.forwarder?.url) {
43 options.headers = { 44 options.headers = {
44 ...(options.headers || {}), 45 ...(options.headers || {}),
45 "X-Homer-Api-Url": url, 46 "X-Homer-Forwarder-Url": url,
46 }; 47 };
47 url = this.proxy.url; 48 url = this.forwarder.url;
48 } 49 }
49 50
50 options = merge(options, init); 51 options = merge(options, init);