1
0
mirror of https://gitee.com/sui-feng-cb/AzurLaneAutoScript1 synced 2026-03-14 10:46:02 +08:00
Files
AzurLaneAutoScript/webapp/packages/renderer/src/store/modules/app.ts
SevCrane 5e482958f6 AlasGG
2024-06-05 23:20:28 +08:00

54 lines
1.2 KiB
TypeScript

import {defineStore} from 'pinia';
import {store} from '/@/store';
import type {LocaleType, ThemeVal} from '/#/config';
import type {repositoryMap} from '/@/settings/repositorySeeing';
export const useAppStore = defineStore({
id: 'app',
state: (): AlasConfig => ({
theme: 'light',
language: 'zh-CN',
repository: 'global',
webuiUrl: '',
alasPath: '',
}),
getters: {
getTheme(): string {
return this.theme;
},
getLanguage(): LocaleType {
return this.language;
},
getRepository(): keyof typeof repositoryMap {
return this.repository;
},
getWebuiUrl(): string {
return this.webuiUrl;
},
getAlasPath(): string {
return this.alasPath;
},
},
actions: {
setTheme(theme: ThemeVal) {
this.theme = theme;
},
setLanguage(language: LocaleType) {
this.language = language;
},
setRepository(repository: AlasConfig['repository']) {
this.repository = repository;
},
setWebuiUrl(webuiUrl: AlasConfig['webuiUrl']) {
this.webuiUrl = webuiUrl;
},
setAlasPath(alasPath: AlasConfig['alasPath']) {
this.alasPath = alasPath;
},
},
});
export function useAppStoreWithOut() {
return useAppStore(store);
}