refactor(client): refactor dialog functions to improve type inference

This commit is contained in:
syuilo
2021-11-18 18:45:58 +09:00
parent 63415f1074
commit ea9aeef9d8
84 changed files with 415 additions and 460 deletions

View File

@ -155,10 +155,9 @@ export default defineComponent({
},
async leaveConfirm(): Promise<boolean> {
const { canceled } = await os.dialog({
const { canceled } = await os.confirm({
type: 'warning',
text: this.$ts.leaveConfirm,
showCancelButton: true
});
return !canceled;
},
@ -205,7 +204,7 @@ export default defineComponent({
try {
parsed = JSON5.parse(this.themeCode);
} catch (e) {
os.dialog({
os.alert({
type: 'error',
text: this.$ts._theme.invalid
});
@ -216,11 +215,9 @@ export default defineComponent({
},
async saveAs() {
const { canceled, result: name } = await os.dialog({
const { canceled, result: name } = await os.inputText({
title: this.$ts.name,
input: {
allowEmpty: false
}
allowEmpty: false
});
if (canceled) return;
@ -236,7 +233,7 @@ export default defineComponent({
ColdDeviceStorage.set('lightTheme', this.theme);
}
this.changed = false;
os.dialog({
os.alert({
type: 'success',
text: this.$t('_theme.installed', { name: this.theme.name })
});