update file struct

This commit is contained in:
Julian Freeman
2026-03-30 19:22:11 -04:00
parent 626a9c21b0
commit 6b64f36cfb
3 changed files with 50 additions and 12 deletions

View File

@@ -15,6 +15,7 @@ export interface LogEntry {
export const useSoftwareStore = defineStore('software', {
state: () => ({
essentials: [] as any[],
essentialsVersion: '',
updates: [] as any[],
allSoftware: [] as any[],
selectedEssentialIds: [] as string[],
@@ -117,7 +118,14 @@ export const useSoftwareStore = defineStore('software', {
},
async fetchEssentials() {
this.essentials = await invoke('get_essentials')
const res = await invoke('get_essentials') as any;
if (res) {
this.essentials = res.essentials;
this.essentialsVersion = res.version;
} else {
this.essentials = [];
this.essentialsVersion = '';
}
},
async fetchUpdates() {
if (this.isBusy) return;
@@ -156,12 +164,20 @@ export const useSoftwareStore = defineStore('software', {
// 在获取全量数据之前,先同步云端清单
await invoke('sync_essentials').catch(() => {});
const [essentials, all, updates] = await Promise.all([
invoke('get_essentials'),
const [repo, all, updates] = await Promise.all([
invoke('get_essentials') as Promise<any>,
invoke('get_all_software'),
invoke('get_updates')
]);
this.essentials = essentials as any[];
if (repo) {
this.essentials = repo.essentials;
this.essentialsVersion = repo.version;
} else {
this.essentials = [];
this.essentialsVersion = '';
}
this.allSoftware = all as any[];
this.updates = updates as any[];
this.lastFetched = Date.now();