Skip to content

Commit

Permalink
Merge pull request #48 from NewWays-TechForImpactKAIST/45-후보자-당선자-전환
Browse files Browse the repository at this point in the history
  • Loading branch information
withSang authored Nov 30, 2023
2 parents 448793a + 2012685 commit 3999b8a
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 12 deletions.
16 changes: 11 additions & 5 deletions src/components/organisms/LocalCouncilReport.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,23 +94,29 @@ const LocalCouncilReport = ({
// 백엔드로부터 텍스트 데이터를 가져옵니다.
const fetchTextData = () => {
axios
.get(`localCouncil/template-data/${metroId}/${localId}?factor=age`)
.get(
`localCouncil/template-data/${metroId}/${localId}?year=${sgYear}&factor=age`,
)
.then(response => {
setAgeTextData(response.data as AgeTextData);
})
.catch(() => {
throw new Error("네트워크 문제가 발생했습니다. 다시 시도해주세요.");
});
axios
.get(`localCouncil/template-data/${metroId}/${localId}?factor=gender`)
.get(
`localCouncil/template-data/${metroId}/${localId}?year=${sgYear}&factor=gender`,
)
.then(response => {
setGenderTextData(response.data as GenderTextData);
})
.catch(() => {
throw new Error("네트워크 문제가 발생했습니다. 다시 시도해주세요.");
});
axios
.get(`localCouncil/template-data/${metroId}/${localId}?factor=party`)
.get(
`localCouncil/template-data/${metroId}/${localId}?year=${sgYear}&factor=party`,
)
.then(response => {
setPartyTextData(response.data as PartyTextData);
})
Expand Down Expand Up @@ -226,7 +232,7 @@ const LocalCouncilReport = ({
onLoaded();
fetchTextData();
fetchGraphData();
}, [metroName, localName]);
}, [metroName, localName, sgYear]);

return (
<Flex
Expand All @@ -242,7 +248,7 @@ const LocalCouncilReport = ({
word-break: keep-all;
`}
>{`${metroName} ${localName}${sgYear}년도 ${
sgType === "candidate" ? "후보자" : "당선인"
sgType === "candidate" ? "후보자" : "당선자"
} 지역의회 다양성 리포트`}</Title>
<Flex
css={css`
Expand Down
16 changes: 11 additions & 5 deletions src/components/organisms/MetroCouncilReport.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,23 +85,29 @@ const MetroCouncilReport = ({ metroName, metroMap, onLoaded }: Props) => {
// 백엔드로부터 텍스트 데이터를 가져옵니다.
const fetchTextData = () => {
axios
.get(`metroCouncil/template-data/${metroId}?factor=age`)
.get(
`metroCouncil/template-data/${metroId}?year=${sgYear}&year=${sgYear}&factor=age`,
)
.then(response => {
setAgeTextData(response.data as AgeTextData);
})
.catch(() => {
throw new Error("네트워크 문제가 발생했습니다. 다시 시도해주세요.");
});
axios
.get(`metroCouncil/template-data/${metroId}?factor=gender`)
.get(
`metroCouncil/template-data/${metroId}?year=${sgYear}&year=${sgYear}&factor=gender`,
)
.then(response => {
setGenderTextData(response.data as GenderTextData);
})
.catch(() => {
throw new Error("네트워크 문제가 발생했습니다. 다시 시도해주세요.");
});
axios
.get(`metroCouncil/template-data/${metroId}?factor=party`)
.get(
`metroCouncil/template-data/${metroId}?year=${sgYear}&year=${sgYear}&factor=party`,
)
.then(response => {
setPartyTextData(response.data as PartyTextData);
})
Expand Down Expand Up @@ -217,7 +223,7 @@ const MetroCouncilReport = ({ metroName, metroMap, onLoaded }: Props) => {
onLoaded();
fetchTextData();
fetchGraphData();
}, [metroName]);
}, [metroName, sgYear]);

return (
<Flex
Expand All @@ -233,7 +239,7 @@ const MetroCouncilReport = ({ metroName, metroMap, onLoaded }: Props) => {
word-break: keep-all;
`}
>{`${metroName}${sgYear}년도 ${
sgType === "candidate" ? "후보자" : "당선인"
sgType === "candidate" ? "후보자" : "당선자"
} 광역의회 다양성 리포트`}</Title>
<Flex
css={css`
Expand Down
4 changes: 2 additions & 2 deletions src/components/organisms/NationalCouncilReport.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ const NationalCouncilReport = ({
onLoaded();
fetchTextData();
fetchGraphData();
}, [metroName, localName]);
}, [metroName, localName, sgYear]);

return (
<Flex
Expand All @@ -238,7 +238,7 @@ const NationalCouncilReport = ({
word-break: keep-all;
`}
>{`${sgYear}년도 ${
sgType === "candidate" ? "후보자" : "당선인"
sgType === "candidate" ? "후보자" : "당선자"
} 총선 다양성 리포트`}</Title>
<Flex
css={css`
Expand Down

0 comments on commit 3999b8a

Please sign in to comment.