From 3694052f2bb19e89c3dfa41cf3b9372c9fef1ba8 Mon Sep 17 00:00:00 2001 From: Kresna Satya Date: Mon, 16 Dec 2024 21:19:25 +0800 Subject: [PATCH] fix: close modal after delete user account and skip preserveScroll --- .../Pages/Profile/Partials/DeleteUserForm.svelte | 14 +++++++------- .../Pages/Profile/Partials/DeleteUserForm.svelte | 6 +++--- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/stubs/inertia-svelte-ts/resources/js/Pages/Profile/Partials/DeleteUserForm.svelte b/stubs/inertia-svelte-ts/resources/js/Pages/Profile/Partials/DeleteUserForm.svelte index b8a5b59..e1c598c 100644 --- a/stubs/inertia-svelte-ts/resources/js/Pages/Profile/Partials/DeleteUserForm.svelte +++ b/stubs/inertia-svelte-ts/resources/js/Pages/Profile/Partials/DeleteUserForm.svelte @@ -16,12 +16,6 @@ password: '' }); - function closeModal() { - $form.clearErrors(); - $form.reset(); - confirmingUserDeletion = false; - } - function confirmUserDeletion() { confirmingUserDeletion = true; setTimeout(() => passwordInput?.focus(), 250); @@ -29,11 +23,17 @@ function deleteUser() { $form.delete(route('profile.destroy'), { - preserveScroll: true, onSuccess: () => closeModal(), onError: () => passwordInput?.focus(), onFinish: () => $form.reset() }); + confirmUserDeletion = false; + } + + function closeModal() { + $form.clearErrors(); + $form.reset(); + confirmingUserDeletion = false; } diff --git a/stubs/inertia-svelte/resources/js/Pages/Profile/Partials/DeleteUserForm.svelte b/stubs/inertia-svelte/resources/js/Pages/Profile/Partials/DeleteUserForm.svelte index 1edeafd..651128d 100644 --- a/stubs/inertia-svelte/resources/js/Pages/Profile/Partials/DeleteUserForm.svelte +++ b/stubs/inertia-svelte/resources/js/Pages/Profile/Partials/DeleteUserForm.svelte @@ -25,18 +25,18 @@ function deleteUser() { $form.delete(route('profile.destroy'), { - preserveScroll: true, onSuccess: () => closeModal(), onError: () => passwordInput?.focus(), onFinish: () => $form.reset(), }); - }; + confirmUserDeletion = false; + } function closeModal() { $form.clearErrors(); $form.reset(); confirmingUserDeletion = false; - }; + }