@yishak621
Posted
Good design but u didn't design a night mode toggler and border country button in the single country page
@victoribironke
Posted
@yishak621 I decided not to do the night mode as it was optional in the style guide. The border countries the API returned were in the short form and the design requested the full country name so I wasn't sure how to do it.
@yishak621
Posted
@vdiqbd o sure u r right ...u can fetch the data again using the shortnames in another endpoint url https://restcountries.com/v3.1/alpha?codes=BRA,GER,ENG
eg . BRA GER...it will grab that country data so from that specific data u can extract the common name and display it
example
//fetching datas using codes endpoint
const codes = borders
.map((border) => {
return border;
})
.join(',');
const newurl = `https://restcountries.com/v3.1/alpha?codes=${codes}`;
const borderCountries = await fetchAllData(newurl);
const newHTML = await borderCountries
.map((border) => {
return `<button class="btn">${border.name.common}</button>`;
})
.join('');
borderCountry.innerHTML = newHTML;
@victoribironke
Posted
@yishak621 Thanks, I have fixed it.