mirror of
https://github.com/datahub-project/datahub.git
synced 2025-12-13 19:17:17 +00:00
update multiple favicons (#5927)
This commit is contained in:
parent
aa93a34678
commit
77d7456cd7
@ -6,13 +6,16 @@ import { AppConfigContext, DEFAULT_APP_CONFIG } from './appConfigContext';
|
|||||||
import { useAppConfigQuery } from './graphql/app.generated';
|
import { useAppConfigQuery } from './graphql/app.generated';
|
||||||
|
|
||||||
function changeFavicon(src) {
|
function changeFavicon(src) {
|
||||||
let link = document.querySelector("link[rel~='icon']") as any;
|
const links = document.querySelectorAll("link[rel~='icon']") as any;
|
||||||
if (!link) {
|
if (!links || links.length === 0) {
|
||||||
link = document.createElement('link');
|
const link = document.createElement('link');
|
||||||
link.rel = 'icon';
|
link.rel = 'icon';
|
||||||
document.getElementsByTagName('head')[0].appendChild(link);
|
document.getElementsByTagName('head')[0].appendChild(link);
|
||||||
}
|
}
|
||||||
link.href = src;
|
links.forEach((link) => {
|
||||||
|
// eslint-disable-next-line no-param-reassign
|
||||||
|
link.href = src;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const AppConfigProvider = ({ children }: { children: React.ReactNode }) => {
|
const AppConfigProvider = ({ children }: { children: React.ReactNode }) => {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user