Files
TakeoutSaaS.TenantUI/apps/web-antd/src/main.ts
MSuMshk bb4bbfc3fc
All checks were successful
Build and Deploy TenantUI / build-and-deploy (push) Successful in 53s
fix: 修复双Token自动刷新链路
2026-02-26 14:46:52 +08:00

46 lines
1.3 KiB
TypeScript

import { initPreferences, updatePreferences } from '@vben/preferences';
import { unmountGlobalLoading } from '@vben/utils';
import { overridesPreferences } from './preferences';
// 仅在显式开启时启用 Mock 数据
if (import.meta.env.DEV && import.meta.env.VITE_NITRO_MOCK === 'true') {
import('./mock');
}
/**
* 应用初始化完成之后再进行页面加载渲染
*/
async function initApplication() {
// name用于指定项目唯一标识
// 用于区分不同项目的偏好设置以及存储数据的key前缀以及其他一些需要隔离的数据
const env = import.meta.env.PROD ? 'prod' : 'dev';
const appVersion = import.meta.env.VITE_APP_VERSION;
const namespace = `${import.meta.env.VITE_APP_NAMESPACE}-${appVersion}-${env}`;
// app偏好设置初始化
await initPreferences({
namespace,
overrides: overridesPreferences,
});
updatePreferences({
app: {
accessMode: 'backend',
defaultHomePath: '/dashboard/console',
enableRefreshToken: true,
loginExpiredMode: 'modal',
},
});
// 启动应用并挂载
// vue应用主要逻辑及视图
const { bootstrap } = await import('./bootstrap');
await bootstrap(namespace);
// 移除并销毁loading
unmountGlobalLoading();
}
initApplication();