Skip to content

Instantly share code, notes, and snippets.

@Dromediansk
Created June 11, 2020 05:06
Show Gist options
  • Save Dromediansk/3bb0f397df437f0ba581c702e771577b to your computer and use it in GitHub Desktop.
Save Dromediansk/3bb0f397df437f0ba581c702e771577b to your computer and use it in GitHub Desktop.
fetch data service
const getAllCountries = async () => {
try {
const response = await fetch(`https://restcountries.eu/rest/v2/all`);
const responseCountries = await response.json();
return responseCountries;
} catch (err) {
console.log(err);
}
};
export const countries = {
getAllCountries,
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment