update multiple favicons (#5927)

This commit is contained in:
Gabe Lyons 2022-09-13 16:20:09 -07:00 committed by GitHub
parent aa93a34678
commit 77d7456cd7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -6,13 +6,16 @@ import { AppConfigContext, DEFAULT_APP_CONFIG } from './appConfigContext';
import { useAppConfigQuery } from './graphql/app.generated';
function changeFavicon(src) {
let link = document.querySelector("link[rel~='icon']") as any;
if (!link) {
link = document.createElement('link');
const links = document.querySelectorAll("link[rel~='icon']") as any;
if (!links || links.length === 0) {
const link = document.createElement('link');
link.rel = 'icon';
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 }) => {