fixed favicon not rendering when not visiting base url

This commit is contained in:
Carter 2025-03-04 15:32:28 -06:00
parent b8d9733d1d
commit 85b184ce5e

View file

@ -17,7 +17,7 @@ function App() {
const whiteLabel = getWhitelabel()
const manifestPath = "/" + whiteLabel.name.replace(/\s/g, "") + "/manifest.json"
const manifestDocument = document.getElementById('manifest-link') as HTMLLinkElement
console.log(manifestPath)
fetch(manifestPath).then(response => {
if (response.ok && manifestDocument) {
manifestDocument.href = manifestPath;
@ -30,12 +30,13 @@ function App() {
// Set favicon
const faviconDocument = document.getElementById("favicon-link") as HTMLLinkElement;
const faviconPath = `${whiteLabel.name.replace(/\s/g, "")}/favicon.ico`;
const faviconPath = `/${whiteLabel.name.replace(/\s/g, "")}/favicon.ico`;
fetch(faviconPath).then(response => {
console.log("response ok: " + response.ok)
if (response.ok && faviconDocument) {
faviconDocument.href = faviconPath;
} else {
faviconDocument.href = "BrandXTechnologies/favicon.ico"
faviconDocument.href = "/BrandXTechnologies/favicon.ico"
}
}).catch(() => {
faviconDocument.href = "BrandXTechnologies/favicon.ico"