From b80b2f54b461ef25c88c4b4753a699d54d64857f Mon Sep 17 00:00:00 2001 From: Alicia Sykes Date: Sun, 27 Jun 2021 09:06:03 +0100 Subject: [PATCH] :sparkles: Re #35: Lets user specify custom headers and statusCheck url --- src/components/LinkItems/Item.vue | 8 ++++++-- src/components/LinkItems/ItemGroup.vue | 2 ++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/components/LinkItems/Item.vue b/src/components/LinkItems/Item.vue index 6bc9ba40..1fd83972 100644 --- a/src/components/LinkItems/Item.vue +++ b/src/components/LinkItems/Item.vue @@ -67,6 +67,8 @@ export default { }, itemSize: String, enableStatusCheck: Boolean, + statusCheckHeaders: Object, + statusCheckUrl: String, statusCheckInterval: Number, }, data() { @@ -141,8 +143,10 @@ export default { checkWebsiteStatus() { this.statusResponse = undefined; const baseUrl = process.env.VUE_APP_DOMAIN || window.location.origin; - const endpoint = `${baseUrl}/ping?url=${this.url}`; - axios.get(endpoint) + const urlToCheck = this.statusCheckUrl || this.url; + const headers = this.statusCheckHeaders || {}; + const endpoint = `${baseUrl}/ping?url=${urlToCheck}`; + axios.get(endpoint, { headers }) .then((response) => { if (response.data) this.statusResponse = response.data; }) diff --git a/src/components/LinkItems/ItemGroup.vue b/src/components/LinkItems/ItemGroup.vue index 87805055..276c762c 100644 --- a/src/components/LinkItems/ItemGroup.vue +++ b/src/components/LinkItems/ItemGroup.vue @@ -27,6 +27,8 @@ :target="item.target" :color="item.color" :backgroundColor="item.backgroundColor" + :statusCheckUrl="item.statusCheckUrl" + :statusCheckHeaders="item.statusCheckHeaders" :itemSize="newItemSize" :enableStatusCheck="shouldEnableStatusCheck(item.statusCheck)" :statusCheckInterval="getStatusCheckInterval()"