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();
|
||||
this.remove();
|
||||
},
|
||||
submit(e) {
|
||||
async submit(e) {
|
||||
e.preventDefault();
|
||||
const text = this.$('textarea').val();
|
||||
if (text.length === 0) {
|
||||
return;
|
||||
}
|
||||
// eslint-disable-next-line more/no-then
|
||||
window.log.publish(text).then((url) => {
|
||||
const view = new Whisper.DebugLogLinkView({
|
||||
url,
|
||||
el: this.$('.result'),
|
||||
});
|
||||
this.$('.loading').removeClass('loading');
|
||||
view.render();
|
||||
this.$('.link').focus().select();
|
||||
});
|
||||
|
||||
this.$('.buttons, textarea').remove();
|
||||
this.$('.result').addClass('loading');
|
||||
|
||||
const publishedLogURL = await window.log.publish(text);
|
||||
const view = new Whisper.DebugLogLinkView({
|
||||
url: publishedLogURL,
|
||||
el: this.$('.result'),
|
||||
});
|
||||
this.$('.loading').removeClass('loading');
|
||||
view.render();
|
||||
this.$('.link').focus().select();
|
||||
},
|
||||
});
|
||||
}());
|
||||
|
|
Loading…
Reference in a new issue