From 2392153af1b61d33aa8267b8b5eb2bf9ad387a99 Mon Sep 17 00:00:00 2001 From: Ahmed Ejaz Date: Tue, 7 Nov 2023 04:58:21 +0500 Subject: [PATCH] #1427, fix disabled button issue --- .../retrospring/features/inbox/entry/delete.ts | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/app/javascript/retrospring/features/inbox/entry/delete.ts b/app/javascript/retrospring/features/inbox/entry/delete.ts index a03b3914..0036685f 100644 --- a/app/javascript/retrospring/features/inbox/entry/delete.ts +++ b/app/javascript/retrospring/features/inbox/entry/delete.ts @@ -7,7 +7,6 @@ import { showNotification, showErrorNotification } from 'utilities/notifications export function deleteEntryHandler(event: Event): void { const element: HTMLButtonElement = event.target as HTMLButtonElement; - element.disabled = true; const data = { id: element.getAttribute('data-ib-id') @@ -22,11 +21,8 @@ export function deleteEntryHandler(event: Event): void { confirmButtonText: I18n.translate('voc.delete'), cancelButtonText: I18n.translate('voc.cancel'), closeOnConfirm: true - }, (returnValue) => { - if (returnValue === false) { - element.disabled = false; - return; - } + }, () => { + element.disabled = true; post('/ajax/delete_inbox', { body: data, @@ -44,6 +40,7 @@ export function deleteEntryHandler(event: Event): void { (inboxEntry as HTMLElement).remove(); }) .catch(err => { + element.disabled = false; console.log(err); showErrorNotification(I18n.translate('frontend.error.message')); });