web/elements: trigger refresh on successful modalform submit

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-03-29 19:20:21 +02:00
parent 1e58941323
commit 6c999d10c3
1 changed files with 7 additions and 0 deletions

View File

@ -1,5 +1,6 @@
import { gettext } from "django"; import { gettext } from "django";
import { customElement, html, TemplateResult } from "lit-element"; import { customElement, html, TemplateResult } from "lit-element";
import { EVENT_REFRESH } from "../../constants";
import { ModalButton } from "../buttons/ModalButton"; import { ModalButton } from "../buttons/ModalButton";
import { Form } from "./Form"; import { Form } from "./Form";
@ -14,6 +15,12 @@ export class ModalForm extends ModalButton {
} }
formPromise.then(() => { formPromise.then(() => {
this.open = false; this.open = false;
this.dispatchEvent(
new CustomEvent(EVENT_REFRESH, {
bubbles: true,
composed: true,
})
);
}).catch((e) => { }).catch((e) => {
console.log(e); console.log(e);
}); });