#1427, fix disabled button issue

This commit is contained in:
Ahmed Ejaz 2023-11-07 04:58:21 +05:00 committed by Andreas Nedbal
parent 4314010535
commit 2392153af1
1 changed files with 3 additions and 6 deletions

View File

@ -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'));
});