From 5e53bdc7dd45ad2d2a319a3ae24c872c5fb932d8 Mon Sep 17 00:00:00 2001 From: chrisduma-ledger Date: Tue, 3 Sep 2024 16:18:20 +0300 Subject: [PATCH] chore: refactor --- .../Platform/Exchange/CompleteExchange/Body.tsx | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/apps/ledger-live-desktop/src/renderer/modals/Platform/Exchange/CompleteExchange/Body.tsx b/apps/ledger-live-desktop/src/renderer/modals/Platform/Exchange/CompleteExchange/Body.tsx index e35455d04325..1bd8e0495e0f 100644 --- a/apps/ledger-live-desktop/src/renderer/modals/Platform/Exchange/CompleteExchange/Body.tsx +++ b/apps/ledger-live-desktop/src/renderer/modals/Platform/Exchange/CompleteExchange/Body.tsx @@ -172,6 +172,12 @@ const Body = ({ data, onClose }: { data: Data; onClose?: () => void | undefined }; }; + const handleTransactionResult = (result: ResultsState, operation: Operation) => { + setResult(result); + + onResult(operation); + }; + const handleSwapTransaction = (operation: Operation, result: ResultsState) => { const newResult = { operation, @@ -183,15 +189,11 @@ const Body = ({ data, onClose }: { data: Data; onClose?: () => void | undefined magnitudeAwareRate: magnitudeAwareRate as BigNumber, }); - setResult(result); - - onResult(operation); + handleTransactionResult(result, operation); }; const handleSellTransaction = (operation: Operation, result: ResultsState) => { - setResult(result); - - onResult(operation); + handleTransactionResult(result, operation); }; const onBroadcastSuccess = useCallback(