refactor: add supplementary insurance handling in Form component and update Detail component to fetch insurance data
This commit is contained in:
@@ -17,6 +17,7 @@ function Detail({
|
||||
setIsPay,
|
||||
}) {
|
||||
const [insurance, setInsurance] = useState();
|
||||
const [supplementaryInsurance, setSupplementaryInsurance] = useState();
|
||||
const changeData = (value, type, name) =>
|
||||
setData({
|
||||
...data,
|
||||
@@ -27,11 +28,19 @@ function Detail({
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
// دریافت لیست بیمه پایه
|
||||
request.getInsuranceType().then((res) => {
|
||||
if (res && res.data) {
|
||||
setInsurance(res.data);
|
||||
}
|
||||
});
|
||||
|
||||
// دریافت لیست بیمه تکمیلی
|
||||
request.getSupplementaryInsurance().then((res) => {
|
||||
if (res && res.data) {
|
||||
setSupplementaryInsurance(res.data);
|
||||
}
|
||||
});
|
||||
}, []);
|
||||
|
||||
return (
|
||||
@@ -56,6 +65,7 @@ function Detail({
|
||||
<Form
|
||||
data={data}
|
||||
insurance={insurance}
|
||||
supplementaryInsurance={supplementaryInsurance}
|
||||
changeData={changeData}
|
||||
isForAnother={isForAnother}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user