refactor: enhance form validation and error handling in EditField, DefaultSelect, and Form components

This commit is contained in:
hamed
2025-11-18 09:16:01 +03:30
parent ebc6c246b9
commit 3268b3c51e
6 changed files with 117 additions and 36 deletions
+4 -1
View File
@@ -18,6 +18,8 @@ function Detail({
}) {
const [insurance, setInsurance] = useState();
const [supplementaryInsurance, setSupplementaryInsurance] = useState();
const [errors, setErrors] = useState({});
const changeData = (value, type, name) =>
setData({
...data,
@@ -68,6 +70,7 @@ function Detail({
supplementaryInsurance={supplementaryInsurance}
changeData={changeData}
isForAnother={isForAnother}
errors={errors}
/>
{!isForAnother && (
<Button
@@ -87,7 +90,7 @@ function Detail({
</p>
</Button>
)}
<SubmitData setStep={setStep} data={data} prevData={prevData} />
<SubmitData setStep={setStep} data={data} prevData={prevData} setErrors={setErrors} />
</div>
</div>
);