| 12 | import { fetchBootstrap, type BootstrapInfo } from '@api/system'; |
| 13 | |
| 14 | interface BootstrapState { |
| 15 | info: BootstrapInfo | null; |
| 16 | loading: boolean; |
| 17 | error: string | null; |
| 18 | /** 应用启动时调用;若已加载则不重复请求。 */ |
| 19 | ensureLoaded: () => Promise<void>; |
| 20 | /** 主动刷新(初始化完成、系统配置保存后)。 */ |
| 21 | refresh: () => Promise<void>; |
| 22 | } |
| 23 | |
| 24 | async function loadOnce(set: (s: Partial<BootstrapState>) => void) { |
| 25 | set({ loading: true, error: null }); |
nothing calls this directly
no outgoing calls
no test coverage detected