#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 { export function deleteEntryHandler(event: Event): void {
const element: HTMLButtonElement = event.target as HTMLButtonElement; const element: HTMLButtonElement = event.target as HTMLButtonElement;
element.disabled = true;
const data = { const data = {
id: element.getAttribute('data-ib-id') id: element.getAttribute('data-ib-id')
@ -22,11 +21,8 @@ export function deleteEntryHandler(event: Event): void {
confirmButtonText: I18n.translate('voc.delete'), confirmButtonText: I18n.translate('voc.delete'),
cancelButtonText: I18n.translate('voc.cancel'), cancelButtonText: I18n.translate('voc.cancel'),
closeOnConfirm: true closeOnConfirm: true
}, (returnValue) => { }, () => {
if (returnValue === false) { element.disabled = true;
element.disabled = false;
return;
}
post('/ajax/delete_inbox', { post('/ajax/delete_inbox', {
body: data, body: data,
@ -44,6 +40,7 @@ export function deleteEntryHandler(event: Event): void {
(inboxEntry as HTMLElement).remove(); (inboxEntry as HTMLElement).remove();
}) })
.catch(err => { .catch(err => {
element.disabled = false;
console.log(err); console.log(err);
showErrorNotification(I18n.translate('frontend.error.message')); showErrorNotification(I18n.translate('frontend.error.message'));
}); });