fix step and password error

This commit is contained in:
ayntk-ai
2024-09-02 23:48:05 +02:00
parent 70043c24cf
commit c24fec9c45

View File

@@ -62,7 +62,7 @@
if (this.confirmWithPassword) { if (this.confirmWithPassword) {
this.passwordError = this.validatePassword(); this.passwordError = this.validatePassword();
if (this.passwordError) { if (this.passwordError) {
return; return Promise.resolve(this.passwordError);
} }
} }
@@ -78,10 +78,9 @@
return $wire[methodName](...params) return $wire[methodName](...params)
.then(result => { .then(result => {
if (result === true) { if (result === true) {
this.modalOpen = false; return true;
this.resetModal();
} else if (typeof result === 'string') { } else if (typeof result === 'string') {
this.passwordError = result; return result;
} }
}); });
}, },
@@ -279,9 +278,13 @@
if (dispatchEvent) { if (dispatchEvent) {
$wire.dispatch(dispatchEventType, dispatchEventMessage); $wire.dispatch(dispatchEventType, dispatchEventMessage);
} }
modalOpen = false; if (confirmWithPassword) {
resetModal(); step++;
confirmWithPassword ? step++ : submitForm()"> } else {
modalOpen = false;
resetModal();
submitForm();
}">
<span x-text="step2ButtonText"></span> <span x-text="step2ButtonText"></span>
</x-forms.button> </x-forms.button>
</template> </template>
@@ -291,9 +294,15 @@
if (dispatchEvent) { if (dispatchEvent) {
$wire.dispatch(dispatchEventType, dispatchEventMessage); $wire.dispatch(dispatchEventType, dispatchEventMessage);
} }
modalOpen = false; submitForm().then((result) => {
resetModal(); if (result === true) {
submitForm()"> modalOpen = false;
resetModal();
} else {
passwordError = result;
}
});
">
<span x-text="step3ButtonText"></span> <span x-text="step3ButtonText"></span>
</x-forms.button> </x-forms.button>
</template> </template>