Skip to content

Commit

Permalink
Merge pull request #133 from Weflo-A/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
ymj07168 authored Mar 10, 2024
2 parents c993318 + 7083cde commit 36cb24d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
6 changes: 6 additions & 0 deletions src/api/estimate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ export const getRepairCompany = async (model: string, type: string[]) => {
return await client.get(`/api/repair-stores?model=${model}&type=${type}`);
};

// 장바구니 총합 조회
export const getBasketList = async (checkedList: string[]) => {
return await client.get(`api/components?names=${checkedList}`);
};

// 드론 모델 명 조회
export const getDroneModel = async (droneId: number) => {
return await client.get(`api/drone/${droneId}`);
};
11 changes: 7 additions & 4 deletions src/pages/EstimatePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import TotalScoreChart from 'src/components/estimate/TotalScoreChart';
import SectionTab from 'src/components/estimate/SectionTab';
import {
getBasketList,
getDroneModel,
getEstimateInfo,
getRepairCompany,
getTestDateList,
Expand Down Expand Up @@ -107,6 +108,7 @@ const EstimatePage = () => {
const { id } = useParams();
const [drones, setDrones] = React.useState<Drone[]>();
const [currentDrone, setCurrentDrone] = React.useState<Drone>();
const [droneModel, setDroneModel] = React.useState();
const [newPartsFilter, setNewPartsFilter] = React.useState('score');

/* 날짜 Select */
Expand Down Expand Up @@ -222,9 +224,12 @@ const EstimatePage = () => {
console.log(res.data.data);
setDrones(res.data.data);
setCurrentDrone(
res.data.data?.filter((item: Drone) => item.id === Number(id))
res.data.data?.filter((item: Drone) => item.id === Number(id))[0]
);
});
getDroneModel(Number(id)).then((res) =>
setDroneModel(res.data.data.modelName)
);
}, []);

/* id 값 변경될 때마다 */
Expand Down Expand Up @@ -661,9 +666,7 @@ const EstimatePage = () => {
>
<CalloutBox>
<Typography variant='body1' color={colors.basic700}>
<span style={{ color: colors.accent100 }}>
{currentDrone?.name}
</span>
<span style={{ color: colors.accent100 }}>{droneModel}</span>
{topSection?.components[0].type ===
topSection?.components[1].type ? (
Expand Down

0 comments on commit 36cb24d

Please sign in to comment.