From 59c0dce9b4e90732f155c99be5e433f23e8638c0 Mon Sep 17 00:00:00 2001 From: Karina Kwiatek Date: Tue, 7 Feb 2023 23:39:13 +0100 Subject: [PATCH] Disable relationship action buttons while waiting for a response --- app/javascript/retrospring/features/user/action.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/javascript/retrospring/features/user/action.ts b/app/javascript/retrospring/features/user/action.ts index d9605c3e..91ad152e 100644 --- a/app/javascript/retrospring/features/user/action.ts +++ b/app/javascript/retrospring/features/user/action.ts @@ -7,6 +7,7 @@ export function userActionHandler(event: Event): void { const button: HTMLButtonElement = event.target as HTMLButtonElement; const target = button.dataset.target; const action = button.dataset.action; + button.disabled = true; let targetURL, relationshipType; @@ -56,6 +57,7 @@ export function userActionHandler(event: Event): void { showErrorNotification(I18n.translate('frontend.error.message')); }) .finally(() => { + button.disabled = false; if (!success) return; switch (action) {