DEV: make possible to pass both async and sync callbacks to the user status modal (#18712)

This commit is contained in:
Andrei Prigorshnev 2022-10-26 04:59:08 +04:00 committed by GitHub
parent 9dd431c272
commit 9129f18815
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 6 deletions

View File

@ -157,8 +157,8 @@ export default Controller.extend(CanCheckEmails, {
modalClass: "user-status",
model: {
status,
saveAction: async (s) => this.set("newStatus", s),
deleteAction: async () => this.set("newStatus", null),
saveAction: (s) => this.set("newStatus", s),
deleteAction: () => this.set("newStatus", null),
},
});
},

View File

@ -52,8 +52,7 @@ export default Controller.extend(ModalFunctionality, {
@action
delete() {
this.model
.deleteAction()
Promise.resolve(this.model.deleteAction())
.then(() => this.send("closeModal"))
.catch((e) => this._handleError(e));
},
@ -71,8 +70,7 @@ export default Controller.extend(ModalFunctionality, {
ends_at: this.status.endsAt?.toISOString(),
};
this.model
.saveAction(newStatus)
Promise.resolve(this.model.saveAction(newStatus))
.then(() => this.send("closeModal"))
.catch((e) => this._handleError(e));
},