update file struct
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user