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

@@ -171,16 +171,15 @@ export default defineComponent({
userId: this.user.id,
});
os.dialog({
os.alert({
type: 'success',
text: this.$t('newPasswordIs', { password })
});
},
async toggleSilence(v) {
const confirm = await os.dialog({
const confirm = await os.confirm({
type: 'warning',
showCancelButton: true,
text: v ? this.$ts.silenceConfirm : this.$ts.unsilenceConfirm,
});
if (confirm.canceled) {
@@ -192,9 +191,8 @@ export default defineComponent({
},
async toggleSuspend(v) {
const confirm = await os.dialog({
const confirm = await os.confirm({
type: 'warning',
showCancelButton: true,
text: v ? this.$ts.suspendConfirm : this.$ts.unsuspendConfirm,
});
if (confirm.canceled) {
@@ -211,9 +209,8 @@ export default defineComponent({
},
async deleteAllFiles() {
const confirm = await os.dialog({
const confirm = await os.confirm({
type: 'warning',
showCancelButton: true,
text: this.$ts.deleteAllFilesConfirm,
});
if (confirm.canceled) return;
@@ -222,7 +219,7 @@ export default defineComponent({
os.success();
};
await process().catch(e => {
os.dialog({
os.alert({
type: 'error',
text: e.toString()
});