refactor: 重构偏好模块.

This commit is contained in:
lijiahang
2023-12-19 17:48:48 +08:00
parent 581c14d8d7
commit bb83fe447b
24 changed files with 237 additions and 211 deletions

View File

@@ -24,8 +24,7 @@
import type { SelectOption } from '@arco-design/web-vue/es/select/interface';
import { useAppStore } from '@/store';
import FormWrapper from './form-wrapper.vue';
import { updatePreferencePartial } from '@/api/user/preference';
import { Message } from '@arco-design/web-vue';
import { updatePreference } from '@/api/user/preference';
interface OptionsProps {
name: string;
@@ -61,20 +60,15 @@
});
}
// 修改配置
const updateConfig = { [key]: value };
appStore.updateSettings(updateConfig);
appStore.updateSettings({ [key]: value });
// 同步偏好
Message.clear();
const loading = Message.loading('同步中...');
try {
await updatePreferencePartial({
await updatePreference({
type: 'SYSTEM',
config: updateConfig
item: key,
value
});
Message.success('同步成功');
} catch (e) {
} finally {
loading.close();
}
};
</script>