fix: 解决浏览器切换时部分设置未同步的问题 (#5436)

Refs #5422
This commit is contained in:
ssongliu 2024-06-13 11:52:35 +08:00 committed by GitHub
parent 09dc15a940
commit b6f2497346
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 11 additions and 1 deletions

View file

@ -1,4 +1,4 @@
import { getLicenseStatus } from '@/api/modules/setting'; import { getLicenseStatus, getSettingInfo } from '@/api/modules/setting';
import { useTheme } from '@/hooks/use-theme'; import { useTheme } from '@/hooks/use-theme';
import { GlobalStore } from '@/store'; import { GlobalStore } from '@/store';
const globalStore = GlobalStore(); const globalStore = GlobalStore();
@ -33,6 +33,14 @@ export async function getXpackSetting() {
return res; return res;
} }
const loadDataFromDB = async () => {
const res = await getSettingInfo();
document.title = res.data.panelName;
globalStore.entrance = res.data.securityEntrance;
globalStore.setDefaultNetwork(res.data.defaultNetwork);
globalStore.setOpenMenuTabs(res.data.menuTabs === 'enable');
};
export async function loadProductProFromDB() { export async function loadProductProFromDB() {
const res = await getLicenseStatus(); const res = await getLicenseStatus();
if (!res.data) { if (!res.data) {
@ -48,6 +56,7 @@ export async function loadProductProFromDB() {
} }
switchTheme(); switchTheme();
initFavicon(); initFavicon();
loadDataFromDB();
} }
export async function getXpackSettingForTheme() { export async function getXpackSettingForTheme() {

View file

@ -361,6 +361,7 @@ const loadDataFromDB = async () => {
i18n.locale.value = res.data.language; i18n.locale.value = res.data.language;
i18n.warnHtmlMessage = false; i18n.warnHtmlMessage = false;
globalStore.entrance = res.data.securityEntrance; globalStore.entrance = res.data.securityEntrance;
globalStore.setDefaultNetwork(res.data.defaultNetwork);
globalStore.setOpenMenuTabs(res.data.menuTabs === 'enable'); globalStore.setOpenMenuTabs(res.data.menuTabs === 'enable');
globalStore.updateLanguage(res.data.language); globalStore.updateLanguage(res.data.language);
globalStore.setThemeConfig({ ...themeConfig.value, theme: res.data.theme, panelName: res.data.panelName }); globalStore.setThemeConfig({ ...themeConfig.value, theme: res.data.theme, panelName: res.data.panelName });