Last active
November 26, 2020 05:06
-
-
Save xiongemi/9a854f7dbb96d6c6961789f0d7175beb to your computer and use it in GitHub Desktop.
countries service file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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