mirror of
https://github.com/shuaiplus/nodewarden.git
synced 2026-06-21 05:10:41 +00:00
Improve app startup and route fallbacks
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
let workspacePreload: Promise<unknown> | null = null;
|
||||
let adminPreload: Promise<unknown> | null = null;
|
||||
|
||||
export function preloadAuthenticatedWorkspace(isAdmin: boolean): Promise<unknown> {
|
||||
if (!workspacePreload) {
|
||||
workspacePreload = Promise.allSettled([
|
||||
import('@/components/SendsPage'),
|
||||
import('@/components/TotpCodesPage'),
|
||||
import('@/components/SettingsPage'),
|
||||
import('@/components/SecurityDevicesPage'),
|
||||
]);
|
||||
}
|
||||
|
||||
if (!isAdmin) {
|
||||
return workspacePreload;
|
||||
}
|
||||
|
||||
if (!adminPreload) {
|
||||
adminPreload = Promise.allSettled([
|
||||
workspacePreload,
|
||||
import('@/components/AdminPage'),
|
||||
import('@/components/BackupCenterPage'),
|
||||
]);
|
||||
}
|
||||
|
||||
return adminPreload;
|
||||
}
|
||||
Reference in New Issue
Block a user