refactor: add supplementary insurance handling in Form component and update Detail component to fetch insurance data

This commit is contained in:
hamed
2025-11-17 15:48:33 +03:30
parent b46a017773
commit 8c03717cb7
3 changed files with 36 additions and 4 deletions
+10
View File
@@ -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}
/>