Make DebugLogView::submit
async
This commit is contained in:
parent
acf48595f3
commit
e4b34a6287
1 changed files with 11 additions and 11 deletions
|
@ -46,24 +46,24 @@
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
this.remove();
|
this.remove();
|
||||||
},
|
},
|
||||||
submit(e) {
|
async submit(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
const text = this.$('textarea').val();
|
const text = this.$('textarea').val();
|
||||||
if (text.length === 0) {
|
if (text.length === 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// eslint-disable-next-line more/no-then
|
|
||||||
window.log.publish(text).then((url) => {
|
this.$('.buttons, textarea').remove();
|
||||||
|
this.$('.result').addClass('loading');
|
||||||
|
|
||||||
|
const publishedLogURL = await window.log.publish(text);
|
||||||
const view = new Whisper.DebugLogLinkView({
|
const view = new Whisper.DebugLogLinkView({
|
||||||
url,
|
url: publishedLogURL,
|
||||||
el: this.$('.result'),
|
el: this.$('.result'),
|
||||||
});
|
});
|
||||||
this.$('.loading').removeClass('loading');
|
this.$('.loading').removeClass('loading');
|
||||||
view.render();
|
view.render();
|
||||||
this.$('.link').focus().select();
|
this.$('.link').focus().select();
|
||||||
});
|
|
||||||
this.$('.buttons, textarea').remove();
|
|
||||||
this.$('.result').addClass('loading');
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}());
|
}());
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue