web/elements: fix detection of inner forms, catch errors and don't close modal
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
parent
72cca0473a
commit
2e58982419
|
@ -7,13 +7,15 @@ import { Form } from "./Form";
|
|||
export class ModalForm extends ModalButton {
|
||||
|
||||
confirm(): void {
|
||||
this.querySelectorAll<Form<unknown>>("ak-form").forEach(form => {
|
||||
this.querySelectorAll<Form<unknown>>("[slot=form]").forEach(form => {
|
||||
const formPromise = form.submit(new Event("submit"));
|
||||
if (!formPromise) {
|
||||
return;
|
||||
}
|
||||
formPromise.then(() => {
|
||||
formPromise.then((a) => {
|
||||
this.open = false;
|
||||
}).catch((e) => {
|
||||
console.log(e);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
Reference in a new issue