diff --git a/html/index.html b/html/index.html index 37b6ab6..5095c4a 100644 --- a/html/index.html +++ b/html/index.html @@ -273,14 +273,14 @@ }, methods: { async fetchData() { - const response = await fetch("https://api.sampleapis.com/countries/countries"); - + const response = await fetch("https://restcountries.com/v3.1/all"); if (response.ok) { - const data = await response.json(); - const countryNames = data.map((country) => country.name); - const result = countryNames.sort((a, b) => a.localeCompare(b)); + const countries = await response.json(); + const result = countries.sort((a, b) => (a.name.common > b.name.common ? 1 : -1)); - this.nationalities = result; + result.forEach((obj) => { + viewmodel.nationalities.push(obj.name.common); + }); } }, click_character: function(idx, type) {