From c24fec9c453c58c69f8e5c390b188fc09ce126df Mon Sep 17 00:00:00 2001
From: ayntk-ai <122374094+ayntk-ai@users.noreply.github.com>
Date: Mon, 2 Sep 2024 23:48:05 +0200
Subject: [PATCH] fix step and password error
---
.../components/modal-confirmation.blade.php | 29 ++++++++++++-------
1 file changed, 19 insertions(+), 10 deletions(-)
diff --git a/resources/views/components/modal-confirmation.blade.php b/resources/views/components/modal-confirmation.blade.php
index 8e2b06b45..edbb949ba 100644
--- a/resources/views/components/modal-confirmation.blade.php
+++ b/resources/views/components/modal-confirmation.blade.php
@@ -62,7 +62,7 @@
if (this.confirmWithPassword) {
this.passwordError = this.validatePassword();
if (this.passwordError) {
- return;
+ return Promise.resolve(this.passwordError);
}
}
@@ -78,10 +78,9 @@
return $wire[methodName](...params)
.then(result => {
if (result === true) {
- this.modalOpen = false;
- this.resetModal();
+ return true;
} else if (typeof result === 'string') {
- this.passwordError = result;
+ return result;
}
});
},
@@ -279,9 +278,13 @@
if (dispatchEvent) {
$wire.dispatch(dispatchEventType, dispatchEventMessage);
}
- modalOpen = false;
- resetModal();
- confirmWithPassword ? step++ : submitForm()">
+ if (confirmWithPassword) {
+ step++;
+ } else {
+ modalOpen = false;
+ resetModal();
+ submitForm();
+ }">
@@ -291,9 +294,15 @@
if (dispatchEvent) {
$wire.dispatch(dispatchEventType, dispatchEventMessage);
}
- modalOpen = false;
- resetModal();
- submitForm()">
+ submitForm().then((result) => {
+ if (result === true) {
+ modalOpen = false;
+ resetModal();
+ } else {
+ passwordError = result;
+ }
+ });
+ ">