Skip to content

Instantly share code, notes, and snippets.

@xiongemi
Last active November 26, 2020 05:06
Show Gist options
  • Select an option

  • Save xiongemi/9a854f7dbb96d6c6961789f0d7175beb to your computer and use it in GitHub Desktop.

Select an option

Save xiongemi/9a854f7dbb96d6c6961789f0d7175beb to your computer and use it in GitHub Desktop.
countries service file
import { CountriesResponse } from './models/countries-response.interface';
async function getCountries(): Promise<CountriesResponse> {
const response = await fetch(...);
if (response.ok) {
return response.json();
}
throw response;
}
export const countriesService = { getCountries };
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment