From 30720d0738a80de0c1077da7a7fa0a033015ce77 Mon Sep 17 00:00:00 2001 From: Teriuihi Date: Sun, 11 Aug 2024 19:09:31 +0200 Subject: [PATCH] Refactor type and string handling in ThankYou component Changed the `DynamicFormData` type to accept any data type, enhancing flexibility. Updated string handling to be more explicit with type checks, ensuring newline handling works correctly for strings only. --- src/components/verify_email/thank_you.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/components/verify_email/thank_you.tsx b/src/components/verify_email/thank_you.tsx index 53740de..babb235 100644 --- a/src/components/verify_email/thank_you.tsx +++ b/src/components/verify_email/thank_you.tsx @@ -6,7 +6,7 @@ import './ThankYou.css'; const ThankYou: FC = () => { const location = useLocation(); type DynamicFormData = { - [key: string]: string; + [key: string]: any; }; if (location.state === null || location.state.formData === undefined) { @@ -30,7 +30,7 @@ const ThankYou: FC = () => {

{key}

{ - value.includes("\n") ? + typeof value === "string" && value.includes("\n") ? value .split("\n") .filter(str => str.trim() !== "") @@ -38,9 +38,9 @@ const ThankYou: FC = () => { :

{value}

}
- ))} - - + ))} + + ) ; }