Fix Bug 60169: Branding for Favicon does not apply

This commit is contained in:
Viktor Fomin 2022-12-27 14:34:19 +03:00
parent fc52606db3
commit d9a6bdcb51

View File

@ -164,6 +164,7 @@ const Shell = ({ items = [], page = "home", ...rest }) => {
setSnackbarExist,
userTheme,
//user,
whiteLabelLogoUrls,
} = rest;
useEffect(() => {
@ -174,6 +175,19 @@ const Shell = ({ items = [], page = "home", ...rest }) => {
}
}, []);
useEffect(() => {
if (!whiteLabelLogoUrls) return;
const favicon = whiteLabelLogoUrls[2]?.path?.light;
let link = document.querySelector("link[rel~='icon']");
if (!link) {
link = document.createElement("link");
link.rel = "icon";
document.getElementsByTagName("head")[0].appendChild(link);
}
link.href = favicon;
}, [whiteLabelLogoUrls]);
useEffect(() => {
socketHelper.emit({
command: "subscribe",
@ -494,6 +508,8 @@ const ShellWrapper = inject(({ auth, backup }) => {
setSnackbarExist,
socketHelper,
setTheme,
getWhiteLabelLogoUrls,
whiteLabelLogoUrls,
} = settingsStore;
const isBase = settingsStore.theme.isBase;
const { setPreparationPortalDialogVisible } = backup;
@ -528,6 +544,7 @@ const ShellWrapper = inject(({ auth, backup }) => {
? "Dark"
: "Base"
: auth?.userStore?.user?.theme,
whiteLabelLogoUrls,
};
})(observer(Shell));