auto-sync: 2026-05-17 11:25:38
This commit is contained in:
@@ -429,8 +429,17 @@ export const useStore = create<AppStore>((set, get) => ({
|
||||
try {
|
||||
const data = await api.liveStatus();
|
||||
set({ liveStatus: data });
|
||||
// Also preload officials for monitor tab
|
||||
// 同步项目列表
|
||||
const projects = (data.syncStatus as any)?.projects || {};
|
||||
set({ projects });
|
||||
// 自动选择第一个项目
|
||||
const s = get();
|
||||
if (!s.selectedProjectId && Object.keys(projects).length > 0) {
|
||||
const firstPid = Object.keys(projects)[0];
|
||||
set({ selectedProjectId: firstPid });
|
||||
setApiProjectId(firstPid);
|
||||
}
|
||||
// Also preload officials for monitor tab
|
||||
if (!s.officialsData) {
|
||||
api.officialsStats().then((d) => set({ officialsData: d })).catch(() => {});
|
||||
}
|
||||
@@ -439,6 +448,21 @@ export const useStore = create<AppStore>((set, get) => ({
|
||||
}
|
||||
},
|
||||
|
||||
loadProjects: async () => {
|
||||
try {
|
||||
const data = await api.projects();
|
||||
set({ projects: data.projects });
|
||||
const s = get();
|
||||
if (!s.selectedProjectId && Object.keys(data.projects).length > 0) {
|
||||
const firstPid = Object.keys(data.projects)[0];
|
||||
set({ selectedProjectId: firstPid });
|
||||
setApiProjectId(firstPid);
|
||||
}
|
||||
} catch {
|
||||
// silently fail
|
||||
}
|
||||
},
|
||||
|
||||
loadAgentConfig: async () => {
|
||||
try {
|
||||
const cfg = await api.agentConfig();
|
||||
|
||||
Reference in New Issue
Block a user