-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add content override to query params
- Loading branch information
1 parent
d9c8f81
commit 2c572ef
Showing
2 changed files
with
15 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,15 @@ | ||
/** Fetch content from `contentSrc` and inject it into element with id `marqueeId`. | ||
* @param {string} marqueeId - The id of the element to inject the content into. | ||
* @param {string} contentSrc - The URL to fetch the content from. | ||
*/ | ||
const fetchContent = async (marqueeId, contentSrc) => { | ||
const fetchContent = async (contentSrc) => { | ||
try { | ||
const response = await fetch(contentSrc, {cache: "no-cache"}); | ||
if (!response.ok) { | ||
throw new Error('Network response was not ok'); | ||
} | ||
const content = await response.text(); | ||
const bannerElement = document.getElementById(marqueeId); | ||
bannerElement.innerHTML = ` ${content} `; | ||
return await response.text(); | ||
} catch (error) { | ||
console.error('Error fetching content:', error); | ||
return null | ||
} | ||
} |