Disable inbox answer button after pressing it to prevent duplicate sending
This commit is contained in:
parent
367fe0e7a6
commit
229c10e358
|
@ -7,6 +7,8 @@ export function answerEntryHandler(event: Event): void {
|
||||||
const element: HTMLButtonElement = event.target as HTMLButtonElement;
|
const element: HTMLButtonElement = event.target as HTMLButtonElement;
|
||||||
const inboxEntry: HTMLElement = element.closest<HTMLElement>('.inbox-entry');
|
const inboxEntry: HTMLElement = element.closest<HTMLElement>('.inbox-entry');
|
||||||
|
|
||||||
|
element.disabled = true;
|
||||||
|
|
||||||
const shareTo = [];
|
const shareTo = [];
|
||||||
inboxEntry.querySelectorAll('input[type=checkbox][name=ib-share]:checked')
|
inboxEntry.querySelectorAll('input[type=checkbox][name=ib-share]:checked')
|
||||||
.forEach((element: HTMLInputElement) => {
|
.forEach((element: HTMLInputElement) => {
|
||||||
|
@ -27,6 +29,7 @@ export function answerEntryHandler(event: Event): void {
|
||||||
success: (data) => {
|
success: (data) => {
|
||||||
if (!data.success) {
|
if (!data.success) {
|
||||||
showErrorNotification(data.message);
|
showErrorNotification(data.message);
|
||||||
|
element.disabled = false;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
updateDeleteButton(false);
|
updateDeleteButton(false);
|
||||||
|
@ -35,6 +38,7 @@ export function answerEntryHandler(event: Event): void {
|
||||||
},
|
},
|
||||||
error: (data, status, xhr) => {
|
error: (data, status, xhr) => {
|
||||||
console.log(data, status, xhr);
|
console.log(data, status, xhr);
|
||||||
|
element.disabled = false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue