mirror of
https://github.com/EstrellaXD/Auto_Bangumi.git
synced 2026-12-01 00:38:13 +08:00
feat: close #16
This commit is contained in:
@@ -11,15 +11,28 @@ export const useConfigStore = defineStore('config', () => {
|
||||
config.value = res;
|
||||
});
|
||||
|
||||
const { execute: set } = useApi(apiConfig.updateConfig, {
|
||||
failRule: (res) => !res,
|
||||
message: {
|
||||
success: 'Apply Success!',
|
||||
fail: 'Apply Failed!',
|
||||
},
|
||||
const { execute: set, onResult: onSetRusult } = useApi(
|
||||
apiConfig.updateConfig,
|
||||
{
|
||||
failRule: (res) => !res,
|
||||
message: {
|
||||
success: 'Apply Success!',
|
||||
fail: 'Apply Failed!',
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
/**
|
||||
* 保持 config 后重启,以应用最新配置
|
||||
*/
|
||||
onSetRusult(() => {
|
||||
const { restart } = useProgramStore();
|
||||
restart();
|
||||
});
|
||||
|
||||
const setConfig = () => set(config.value);
|
||||
const setConfig = () => {
|
||||
set(config.value);
|
||||
};
|
||||
|
||||
function getSettingGroup<Tkey extends keyof Config>(key: Tkey) {
|
||||
return computed<Config[Tkey]>(() => config.value[key]);
|
||||
|
||||
Reference in New Issue
Block a user