refactor: enhance form validation and error handling in EditField, DefaultSelect, and Form components
This commit is contained in:
@@ -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>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user