feat: rudimentary config

This commit is contained in:
2025-02-24 00:01:25 +00:00
parent 70b8b3ae55
commit b7fe76b6ff
11 changed files with 64 additions and 20 deletions

View File

@ -25,6 +25,7 @@ export const usePkgStore = defineStore('pkg', {
profile: (state) => state.prf,
isEnabled: (state) => (pkg: Package | undefined) =>
pkg !== undefined && state.prf?.mods.includes(pkgKey(pkg)),
cfg: (state) => (key: string) => state.prf?.cfg[key]
},
actions: {
setupListeners() {
@ -99,5 +100,11 @@ export const usePkgStore = defineStore('pkg', {
await this.reloadProfile();
await this.saveProfile();
},
async set_cfg(key: string, value: string | boolean | number) {
await invoke('set_cfg', { key, value: `${value}` });
await this.reloadProfile();
await this.saveProfile();
}
},
});
});