mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-02-08 09:30:06 +08:00
19 lines
846 B
Go
19 lines
846 B
Go
|
import { GlobalStore } from '@/store';
|
||
|
import { searchXSetting } from '@/xpack/api/modules/setting';
|
||
|
|
||
|
export const useLogo = async () => {
|
||
|
const globalStore = GlobalStore();
|
||
|
const res = await searchXSetting();
|
||
|
localStorage.setItem('1p-favicon', res.data.logo);
|
||
|
globalStore.themeConfig.title = res.data.title;
|
||
|
globalStore.themeConfig.logo = res.data.logo;
|
||
|
globalStore.themeConfig.logoWithText = res.data.logoWithText;
|
||
|
globalStore.themeConfig.favicon = res.data.favicon;
|
||
|
|
||
|
const link = (document.querySelector("link[rel*='icon']") || document.createElement('link')) as HTMLLinkElement;
|
||
|
link.type = 'image/x-icon';
|
||
|
link.rel = 'shortcut icon';
|
||
|
link.href = globalStore.themeConfig.favicon ? '/api/v1/images/favicon' : '/public/favicon.png';
|
||
|
document.getElementsByTagName('head')[0].appendChild(link);
|
||
|
};
|