From 53ee29d083aae1636d3f53f177f696802d63837c Mon Sep 17 00:00:00 2001 From: FlipWarthog Date: Thu, 12 Oct 2023 20:35:29 -0400 Subject: [PATCH] Use DocSearch in non prod env too --- layouts/AppTopBar.vue | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/layouts/AppTopBar.vue b/layouts/AppTopBar.vue index f01bf70acc..2b1282ebb3 100755 --- a/layouts/AppTopBar.vue +++ b/layouts/AppTopBar.vue @@ -186,7 +186,23 @@ export default { container: '#docsearch', appId: '01CMUF4W4R', indexName: 'primevue', - apiKey: '9bb5939e36897b26ff7de5b7b64d6c43' + apiKey: '9bb5939e36897b26ff7de5b7b64d6c43', + transformItems: (items) => { + const isLocalhost = process.env.NODE_ENV !== 'production'; + + return items.map((item) => { + if (isLocalhost) { + const url = new URL(item.url); + + url.protocol = window.location.protocol; + url.hostname = window.location.hostname; + url.port = window.location.port; + item.url = url.toString(); + } + + return item; + }); + } }); }, beforeUnmount() {