From 916f341da821ad7db815eaa1ff05a32965e14138 Mon Sep 17 00:00:00 2001 From: Christian J Bennett <58433059+ChristianBDev@users.noreply.github.com> Date: Sat, 25 Jan 2025 22:29:54 -0600 Subject: [PATCH 1/2] Added another api for now fixes the api for now --- html/index.html | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/html/index.html b/html/index.html index 37b6ab6..9524e95 100644 --- a/html/index.html +++ b/html/index.html @@ -273,14 +273,16 @@ }, 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)); + + const selectDrop = document.getElementById("nationality"); - this.nationalities = result; + result.forEach((obj) => { + viewmodel.nationalities.push(obj.name.common); + }); } }, click_character: function(idx, type) { From 48b8e63dd310f61d4b01013bbd0852e0e110e091 Mon Sep 17 00:00:00 2001 From: Christian J Bennett <58433059+ChristianBDev@users.noreply.github.com> Date: Sun, 26 Jan 2025 01:30:17 -0600 Subject: [PATCH 2/2] remove unused variable --- html/index.html | 2 -- 1 file changed, 2 deletions(-) diff --git a/html/index.html b/html/index.html index 9524e95..5095c4a 100644 --- a/html/index.html +++ b/html/index.html @@ -278,8 +278,6 @@ const countries = await response.json(); const result = countries.sort((a, b) => (a.name.common > b.name.common ? 1 : -1)); - const selectDrop = document.getElementById("nationality"); - result.forEach((obj) => { viewmodel.nationalities.push(obj.name.common); });