import { ILocationDirectoryResponse , ILocationDirectoryResult } from '../types/location-directory-page' ; import { buildURL , HTTP , NETWORK_BAN_MESSAGE } from '../utils' ; example export const getCountries = async ( ) : Promise < ILocationDirectoryResult > => { const result = { country_list : null , } ; const url = buildURL ( `explore/locations/` ) ; const response = await HTTP < ILocationDirectoryResponse > ( url ) ; const content = response ?. entry_data ?. LocationsDirectoryPage ; if ( content ) { const { country_list = null } = { ... content ?. [ 0 ] } ; result . country_list = country_list ; } else { throw new Error ( NETWORK_BAN_MESSAGE ) ; } return result ; } ; export default getCountries ;