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

@@ -151,13 +151,13 @@ export default defineComponent({
}).catch(err => {
switch (err) {
case 'detected-circular-definition':
os.dialog({
os.alert({
title: this.$ts.unableToProcess,
text: this.$ts.circularReferenceFolder
});
break;
default:
os.dialog({
os.alert({
type: 'error',
text: this.$ts.somethingHappened
});
@@ -191,12 +191,10 @@ export default defineComponent({
},
rename() {
os.dialog({
os.inputText({
title: this.$ts.renameFolder,
input: {
placeholder: this.$ts.inputNewFolderName,
default: this.folder.name
}
placeholder: this.$ts.inputNewFolderName,
default: this.folder.name
}).then(({ canceled, result: name }) => {
if (canceled) return;
os.api('drive/folders/update', {
@@ -216,14 +214,14 @@ export default defineComponent({
}).catch(err => {
switch(err.id) {
case 'b0fc8a17-963c-405d-bfbc-859a487295e1':
os.dialog({
os.alert({
type: 'error',
title: this.$ts.unableToDelete,
text: this.$ts.hasChildFilesOrFolders
});
break;
default:
os.dialog({
os.alert({
type: 'error',
text: this.$ts.unableToDelete
});