From 3350f3c39a3b764b98023dd8c6a6252b87c7b493 Mon Sep 17 00:00:00 2001 From: "DESKTOP-T0O5CDB\\DESK-555BD" Date: Sat, 5 Oct 2024 18:40:37 -0600 Subject: [PATCH] confirm deletion. --- Views/Admin/Index.cshtml | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/Views/Admin/Index.cshtml b/Views/Admin/Index.cshtml index 912738b..b78b5ac 100644 --- a/Views/Admin/Index.cshtml +++ b/Views/Admin/Index.cshtml @@ -136,13 +136,23 @@ }); } function deleteUser(userId) { - $.post(`/Admin/DeleteUser?userId=${userId}`, function (data) { - if (data) { - reloadUserTable(); - } else { - errorToast(genericErrorMessage()); + Swal.fire({ + title: "Confirm Deletion?", + text: "Deleted Users cannot be restored.", + showCancelButton: true, + confirmButtonText: "Delete", + confirmButtonColor: "#dc3545" + }).then((result) => { + if (result.isConfirmed) { + $.post(`/Admin/DeleteUser?userId=${userId}`, function (data) { + if (data) { + reloadUserTable(); + } else { + errorToast(genericErrorMessage()); + } + }); } - }) + }); } function generateNewToken() { Swal.fire({