From bc342e29305b3babd7f8f6dd4f6a876881570f7f Mon Sep 17 00:00:00 2001 From: Eugen Ciur Date: Sun, 27 Oct 2024 10:42:33 +0100 Subject: [PATCH] minor fix --- .../components/customFields/Monetary.tsx | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/ui2/src/features/document/components/customFields/Monetary.tsx b/ui2/src/features/document/components/customFields/Monetary.tsx index f829124b9..cf0488799 100644 --- a/ui2/src/features/document/components/customFields/Monetary.tsx +++ b/ui2/src/features/document/components/customFields/Monetary.tsx @@ -6,15 +6,25 @@ type MonetaryExtraDataType = { currency: string } -function getCurrency(extraData?: string): string | undefined { +function getCurrency( + extraData?: string | MonetaryExtraDataType +): string | undefined { if (!extraData) { return } - const extra_data = JSON.parse(extraData) as MonetaryExtraDataType + if (typeof extraData == "string") { + const extra_data = JSON.parse(extraData) as MonetaryExtraDataType - if (extra_data) { - return extra_data.currency + if (extra_data) { + return extra_data.currency + } + + return + } + + if (extraData.currency) { + return extraData.currency } return