1
0
mirror of https://github.com/flarum/core.git synced 2025-07-17 14:51:19 +02:00

fix: incorrect typings for Modal hide() method (#3180)

* fix: incorrect typings for `hide()`

* fix: swap to arrow calling of hide handler
This commit is contained in:
David Wheatley
2021-11-23 22:54:26 +00:00
committed by GitHub
parent 5b14838770
commit 44e7fc3381

View File

@@ -93,7 +93,7 @@ export default abstract class Modal<ModalAttrs extends IInternalModalAttrs = IIn
<div className="Modal-close App-backControl"> <div className="Modal-close App-backControl">
{Button.component({ {Button.component({
icon: 'fas fa-times', icon: 'fas fa-times',
onclick: this.hide.bind(this), onclick: () => this.hide(),
className: 'Button Button--icon Button--link', className: 'Button Button--icon Button--link',
'aria-label': app.translator.trans('core.lib.modal.close'), 'aria-label': app.translator.trans('core.lib.modal.close'),
})} })}
@@ -148,14 +148,14 @@ export default abstract class Modal<ModalAttrs extends IInternalModalAttrs = IIn
/** /**
* Hides the modal. * Hides the modal.
*/ */
hide() { hide(): void {
this.attrs.state.close(); this.attrs.state.close();
} }
/** /**
* Sets `loading` to false and triggers a redraw. * Sets `loading` to false and triggers a redraw.
*/ */
loaded() { loaded(): void {
this.loading = false; this.loading = false;
m.redraw(); m.redraw();
} }
@@ -164,7 +164,7 @@ export default abstract class Modal<ModalAttrs extends IInternalModalAttrs = IIn
* Shows an alert describing an error returned from the API, and gives focus to * Shows an alert describing an error returned from the API, and gives focus to
* the first relevant field involved in the error. * the first relevant field involved in the error.
*/ */
onerror(error: RequestError) { onerror(error: RequestError): void {
this.alertAttrs = error.alert; this.alertAttrs = error.alert;
m.redraw(); m.redraw();