MCPcopy Create free account
hub / github.com/PIKACHUIM/CFWorkerACME / loadOnce

Function loadOnce

frontend/src/stores/useBootstrapStore.ts:24–44  ·  view source on GitHub ↗
(set: (s: Partial<BootstrapState>) => void)

Source from the content-addressed store, hash-verified

22}
23
24async function loadOnce(set: (s: Partial<BootstrapState>) => void) {
25 set({ loading: true, error: null });
26 try {
27 const info = await fetchBootstrap();
28 set({ info, loading: false, error: null });
29 // 同步站点标题到 document
30 if (info?.site_title) {
31 try {
32 document.title = info.site_title;
33 } catch {
34 /* SSR safe */
35 }
36 }
37 } catch (e: any) {
38 set({
39 info: null,
40 loading: false,
41 error: e?.message ?? '获取系统状态失败',
42 });
43 }
44}
45
46export const useBootstrapStore = create<BootstrapState>((set, get) => ({
47 info: null,

Callers 1

Calls 2

fetchBootstrapFunction · 0.90
setFunction · 0.85

Tested by

no test coverage detected