Skip to content

Commit a451eb6

Browse files
committed
Get countries with cases only
1 parent cc50bcf commit a451eb6

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

store/mutations.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -170,10 +170,16 @@ export default {
170170
SET_COUNTRIES: (state, data) => {
171171
const groupProvinceByCountry = (array, key) => {
172172
return array.reduce((result, currentValue) => {
173-
;(result[currentValue[key]] = result[currentValue[key]] || []).push({
174-
id: currentValue.id,
175-
province: currentValue.province
176-
})
173+
if (
174+
currentValue.latest.confirmed
175+
|| currentValue.latest.deaths
176+
|| currentValue.latest.recovered
177+
) {
178+
;(result[currentValue[key]] = result[currentValue[key]] || []).push({
179+
id: currentValue.id,
180+
province: currentValue.province
181+
})
182+
}
177183
return result
178184
}, {})
179185
}

0 commit comments

Comments
 (0)