From 22fbd89bd617835d2a339f90116e8c3af1db2a9a Mon Sep 17 00:00:00 2001 From: Antal Orcsik Date: Fri, 2 Feb 2024 19:26:54 +0100 Subject: [PATCH] fix topic script --- src/js/changelog-topic.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/js/changelog-topic.js b/src/js/changelog-topic.js index be2d64d..d505979 100644 --- a/src/js/changelog-topic.js +++ b/src/js/changelog-topic.js @@ -20,7 +20,11 @@ function detectTopicFromUrl(url) { const url = new URL(document.location.href); const topicSlugId = detectTopicFromUrl(url); -ChangelogService.loadTopic(topicSlugId).then(topic => { +/** @type {string} */ +const apiBase = document.location.hostname.match(/(localhost|127\.0\.0\.1)/) ? "" : "https://bitrise.io"; +const changelogService = new ChangelogService(apiBase); + +changelogService.loadTopic(topicSlugId).then(topic => { document.getElementById("changelog-topic-title").innerHTML = topic.fancyTitle; document.getElementById("changelog-topic-meta").innerHTML = topic.createdAt.toLocaleDateString();