Improve input dialog
This commit is contained in:
@@ -95,15 +95,6 @@ init((launch) => {
|
||||
});
|
||||
},
|
||||
|
||||
$input(opts) {
|
||||
return new Promise<string>((res, rej) => {
|
||||
const x = window.prompt(opts.title);
|
||||
if (x) {
|
||||
res(x);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
$notify(message) {
|
||||
alert(message);
|
||||
}
|
||||
|
@@ -27,8 +27,8 @@ export default Vue.extend({
|
||||
type: 'warning',
|
||||
text: this.$t('read-all'),
|
||||
showCancelButton: true
|
||||
}).then(res => {
|
||||
if (!res) return;
|
||||
}).then(({ canceled }) => {
|
||||
if (canceled) return;
|
||||
|
||||
this.$root.api('notifications/mark_all_as_read');
|
||||
});
|
||||
|
@@ -38,9 +38,11 @@ export default Vue.extend({
|
||||
},
|
||||
methods: {
|
||||
fn() {
|
||||
this.$input({
|
||||
this.$root.dialog({
|
||||
title: this.$t('enter-list-name'),
|
||||
}).then(async title => {
|
||||
input: true
|
||||
}).then(async ({ canceled, result: title }) => {
|
||||
if (canceled) return;
|
||||
const list = await this.$root.api('users/lists/create', {
|
||||
title
|
||||
});
|
||||
|
@@ -120,7 +120,7 @@ export default Vue.extend({
|
||||
text: this.$t('push-to-list'),
|
||||
action: async () => {
|
||||
const lists = await this.$root.api('users/lists/list');
|
||||
const listId = await this.$root.dialog({
|
||||
const { canceled, result: listId } = await this.$root.dialog({
|
||||
type: null,
|
||||
title: this.$t('select-list'),
|
||||
select: {
|
||||
@@ -130,7 +130,7 @@ export default Vue.extend({
|
||||
},
|
||||
showCancelButton: true
|
||||
});
|
||||
if (!listId) return;
|
||||
if (canceled) return;
|
||||
await this.$root.api('users/lists/push', {
|
||||
listId: listId,
|
||||
userId: this.user.id
|
||||
|
Reference in New Issue
Block a user