web/elements: fix ActionButton
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
parent
1f781eb78a
commit
195951a61a
|
@ -16,7 +16,7 @@ export class ActionButton extends SpinnerButton {
|
|||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
apiRequest: () => Promise<any> = () => { throw new Error(); };
|
||||
|
||||
defaultCallAction(): void {
|
||||
callAction = (): void => {
|
||||
if (this.isRunning === true) {
|
||||
return;
|
||||
}
|
||||
|
@ -39,5 +39,5 @@ export class ActionButton extends SpinnerButton {
|
|||
}
|
||||
this.setDone(ERROR_CLASS);
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ export class SpinnerButton extends LitElement {
|
|||
isRunning = false;
|
||||
|
||||
@property()
|
||||
callAction: () => void = () => {};
|
||||
callAction?: () => void;
|
||||
|
||||
static get styles(): CSSResult[] {
|
||||
return [
|
||||
|
@ -51,9 +51,6 @@ export class SpinnerButton extends LitElement {
|
|||
}, 1000);
|
||||
}
|
||||
|
||||
defaultCallAction(): void {
|
||||
}
|
||||
|
||||
render(): TemplateResult {
|
||||
return html`<button
|
||||
class="pf-c-button pf-m-progress ${this.classList.toString()}"
|
||||
|
@ -62,7 +59,9 @@ export class SpinnerButton extends LitElement {
|
|||
return;
|
||||
}
|
||||
this.setLoading();
|
||||
this.callAction();
|
||||
if (this.callAction) {
|
||||
this.callAction();
|
||||
}
|
||||
}}>
|
||||
${this.isRunning
|
||||
? html` <span class="pf-c-button__progress">
|
||||
|
|
Reference in a new issue