diff --git a/src/pages/Organization/SubmitBrPage/index.js b/src/pages/Organization/SubmitBrPage/index.js index e2c791ba..7dff8632 100644 --- a/src/pages/Organization/SubmitBrPage/index.js +++ b/src/pages/Organization/SubmitBrPage/index.js @@ -102,6 +102,7 @@ const SubmitBrPage = () => { const initialValues = React.useMemo(() => ({ ...formData, + chCompanyName: formData.chCompanyName ?? "", brExpiryDate: null, certificateFile: null, }), [formData]); @@ -143,7 +144,7 @@ const SubmitBrPage = () => { url: UrlUtils.POST_PUB_ORG_SUBMIT_BR, params: { enCompanyName: values.enCompanyName, - chCompanyName: values.chCompanyName, + chCompanyName: values.chCompanyName?.trim() || "", brExpiryDate: DateUtils.dateValue(values.brExpiryDate), address: { country: values.country.type, diff --git a/src/utils/HttpUtils.js b/src/utils/HttpUtils.js index e58f219d..15b2b3cb 100644 --- a/src/utils/HttpUtils.js +++ b/src/utils/HttpUtils.js @@ -82,6 +82,10 @@ export const postWithFiles = ({ url, params, files, onSuccess, onFail, onError } } if (params) for (var key in params) { + // typeof null === "object", and JSON.stringify(null) is the string "null" + if (params[key] == null) { + continue; + } if (typeof params[key] === 'object') { formData.append(key, JSON.stringify(params[key])); } else {