@@ -42,9 +42,14 @@ function fetchCovidSummary() {
42
42
return axios . get ( url ) ;
43
43
}
44
44
45
+ /**
46
+ *
47
+ * @param {'spain' | 'switzerland' } countryCode 스페인과 스위스만 지원됩니다.
48
+ * @returns
49
+ */
45
50
function fetchCountryInfo ( countryCode , status ) {
46
51
// params: confirmed, recovered, deaths
47
- const url = `https://api.covid19api.com/ country/${ countryCode } /status/ ${ status } ` ;
52
+ const url = `https://ts-covid- api.vercel.app/api/ country/${ countryCode } ` ;
48
53
return axios . get ( url ) ;
49
54
}
50
55
@@ -77,20 +82,28 @@ async function handleListClick(event) {
77
82
clearRecoveredList ( ) ;
78
83
startLoadingAnimation ( ) ;
79
84
isDeathLoading = true ;
80
- const { data : deathResponse } = await fetchCountryInfo ( selectedId , 'deaths' ) ;
81
- const { data : recoveredResponse } = await fetchCountryInfo (
82
- selectedId ,
83
- 'recovered' ,
84
- ) ;
85
+
86
+ console . log ( { selectedId} ) ;
87
+
88
+ /**
89
+ * NOTE: 코로나 종식으로 오픈 API 지원이 끝나서 death, recover 데이터는 지원되지 않습니다.
90
+ * 그리고 국가별 상세 정보는 "스페인"과 "스위스"만 지원됩니다.
91
+ */
92
+ // const { data: deathResponse } = await fetchCountryInfo(selectedId, 'deaths');
93
+ // const { data: recoveredResponse } = await fetchCountryInfo(
94
+ // selectedId,
95
+ // 'recovered',
96
+ // );
85
97
const { data : confirmedResponse } = await fetchCountryInfo (
86
98
selectedId ,
87
99
'confirmed' ,
88
100
) ;
89
101
endLoadingAnimation ( ) ;
90
- setDeathsList ( deathResponse ) ;
91
- setTotalDeathsByCountry ( deathResponse ) ;
92
- setRecoveredList ( recoveredResponse ) ;
93
- setTotalRecoveredByCountry ( recoveredResponse ) ;
102
+ // NOTE: 코로나 종식으로 오픈 API 지원이 끝나서 death, recover 데이터는 지원되지 않습니다.
103
+ // setDeathsList(deathResponse);
104
+ // setTotalDeathsByCountry(deathResponse);
105
+ // setRecoveredList(recoveredResponse);
106
+ // setTotalRecoveredByCountry(recoveredResponse);
94
107
setChartData ( confirmedResponse ) ;
95
108
isDeathLoading = false ;
96
109
}
@@ -168,8 +181,6 @@ async function setupData() {
168
181
169
182
function renderChart ( data , labels ) {
170
183
var ctx = $ ( '#lineChart' ) . getContext ( '2d' ) ;
171
- Chart . defaults . color = '#f5eaea' ;
172
- Chart . defaults . font . family = 'Exo 2' ;
173
184
new Chart ( ctx , {
174
185
type : 'line' ,
175
186
data : {
0 commit comments