Merge pull request #4606 from FlipWarthog/PV4605

Fix #4605: Use DocSearch in non prod env too
pull/4572/head
Tuğçe Küçükoğlu 2023-10-13 15:18:43 +03:00 committed by GitHub
commit df4b10b880
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 17 additions and 1 deletions

View File

@ -188,7 +188,23 @@ export default {
container: '#docsearch', container: '#docsearch',
appId: '01CMUF4W4R', appId: '01CMUF4W4R',
indexName: 'primevue', 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() { beforeUnmount() {