From 5587cc736754e95e276fe2bb1ddbe81c118da116 Mon Sep 17 00:00:00 2001 From: anna Date: Mon, 8 Jan 2024 18:16:30 +0800 Subject: [PATCH] fix bug --- .../auth-forms/CustomFormWizard.js | 2 +- .../auth-forms/IAmSmartFormWizard.js | 36 +++++++++---------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/pages/authentication/auth-forms/CustomFormWizard.js b/src/pages/authentication/auth-forms/CustomFormWizard.js index f3855c8..64e70d9 100644 --- a/src/pages/authentication/auth-forms/CustomFormWizard.js +++ b/src/pages/authentication/auth-forms/CustomFormWizard.js @@ -884,7 +884,7 @@ const CustomFormWizard = (props) => { filterOptions={(options) => options} inputValue={selectedIdDocInputType} onChange={(event, newValue) => { - if (newValue != null && newValue !== {}) { + if (newValue != null ) { setSelectedIdDocInputType(newValue.label); setSelectedIdDocType(newValue); if (newValue.type !== "HKID") { diff --git a/src/pages/authentication/auth-forms/IAmSmartFormWizard.js b/src/pages/authentication/auth-forms/IAmSmartFormWizard.js index d9077b4..ee8f752 100644 --- a/src/pages/authentication/auth-forms/IAmSmartFormWizard.js +++ b/src/pages/authentication/auth-forms/IAmSmartFormWizard.js @@ -50,7 +50,7 @@ const CustomFormWizard = (props) => { const [checkUpload, setCheckUpload] = useState(false); const [isLoading, setLoding] = useState(true); - const [captchaImg, setCaptchaImage] = useState([]); + const [captchaImg, setCaptchaImage] = useState(""); const [selectedAddress4, setSelectedAddress4] = useState(null); const [selectedAddress5, setSelectedAddress5] = useState(ComboData.country[0]); @@ -83,28 +83,28 @@ const CustomFormWizard = (props) => { const responseToData = () => { //let rd = JSON.parse("{\"emailAddress\":\"test@gmail.com\",\"postalAddress\":{\"EngPremisesAddress\":{\"EngDistrict\":{\"DcDistrict\":\"KC\",\"Sub-district\":\"TSING YI\"},\"EngEstate\":{\"EstateName\":\"Cheung Hang Estate\",\"EngPhase\":{\"PhaseName\":\"N/A\"}},\"BuildingName\":\"Hang Lai House\",\"EngBlock\":{\"BlockDescriptor\":\"Block\",\"BlockNo\":\"2\"},\"Region\":\"NT\",\"EngStreet\":{\"StreetName\":\"Liu To Road\",\"BuildingNoFrom\":\"6\"},\"Eng3dAddress\":{\"EngFloor\":{\"FloorNum\":\"33\"},\"EngUnit\":{\"UnitDescriptor\":\"Room\",\"UnitNo\":\"3301\"}}}},\"mobileNumber\":{\"CountryCode\":\"852\",\"SubscriberNumber\":\"99999999\"},\"residentialAddress\":{\"ChiPremisesAddress\":{\"Chi3dAddress\":{\"ChiUnit\":{\"UnitDescriptor\":\"室\",\"UnitNo\":\"1010\"},\"ChiFloor\":{\"FloorNum\":\"10\"}},\"ChiBlock\":{\"BlockDescriptor\":\"座\",\"BlockNo\":\"2\"},\"BuildingName\":\"亨麗樓(第2座)\",\"ChiDistrict\":{\"DcDistrict\":\"KC\",\"Sub-district\":\"青衣\"},\"Region\":\"新界\",\"ChiEstate\":{\"EstateName\":\"長亨邨\"},\"ChiStreet\":{\"StreetName\":\"寮肚路\",\"BuildingNoFrom\":\"6\"}}},\"enName\":{\"UnstructuredName\":\"Testing Co One\"},\"idNo\":{\"Identification\":\"G561107\",\"CheckDigit\":\"4\"},\"chName\":{\"ChineseName\":\"測試商一\"}}"); - let rd = props.state.responseData; + let rd = location.state?.responseData; let data = { - "enName": rd.enName?.UnstructuredName ?? "", - "chName": rd.chName?.ChineseName ?? "", - "idNo": rd.idNo?.Identification ?? "", - "checkDigit": rd.idNo?.CheckDigit ?? "", - "email": rd.emailAddress ?? "", - "phone": rd.mobileNumber?.SubscriberNumber ?? "", - "phoneCountryCode": rd.mobileNumber?.CountryCode ?? "", + "enName": rd?.enName?.UnstructuredName ?? "", + "chName": rd?.chName?.ChineseName ?? "", + "idNo": rd?.idNo?.Identification ?? "", + "checkDigit": rd?.idNo?.CheckDigit ?? "", + "email": rd?.emailAddress ?? "", + "phone": rd?.mobileNumber?.SubscriberNumber ?? "", + "phoneCountryCode": rd?.mobileNumber?.CountryCode ?? "", }; - if (rd.postalAddress) { - if (rd.postalAddress.EngPremisesAddress) { - data["address1"] = getAddressEng(rd.postalAddress.EngPremisesAddress); + if (rd?.postalAddress) { + if (rd?.postalAddress?.EngPremisesAddress) { + data["address1"] = getAddressEng(rd?.postalAddress?.EngPremisesAddress); } else if (rd.postalAddress.ChiPremisesAddress) { - data["address1"] = getAddressChi(rd.postalAddress.ChiPremisesAddress); + data["address1"] = getAddressChi(rd?.postalAddress?.ChiPremisesAddress); } - } else if (rd.residentialAddress) { - if (rd.residentialAddress.EngPremisesAddress) { - data["address1"] = getAddressEng(rd.residentialAddress.EngPremisesAddress); - } else if (rd.residentialAddress.ChiPremisesAddress) { - data["address1"] = getAddressChi(rd.residentialAddress.ChiPremisesAddress); + } else if (rd?.residentialAddress) { + if (rd?.residentialAddress?.EngPremisesAddress) { + data["address1"] = getAddressEng(rd?.residentialAddress?.EngPremisesAddress); + } else if (rd?.residentialAddress?.ChiPremisesAddress) { + data["address1"] = getAddressChi(rd?.residentialAddress?.ChiPremisesAddress); } }