Skip to content

Commit

Permalink
Merge pull request #262 from ChristianBDev/main
Browse files Browse the repository at this point in the history
Added another api for now
  • Loading branch information
GhzGarage authored Jan 27, 2025
2 parents 2126324 + 48b8e63 commit ea4b8c9
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit ea4b8c9

Please sign in to comment.