import { IPlacesResponse , IPlacesResult } from '../types/places-page' ; import { HTTP , buildURL , NETWORK_BAN_MESSAGE } from '../utils' ; example export const getPlacesByCityId = async ( cityId ) : Promise < IPlacesResult > => { const result = { place : { city_info : null , country_info : null , location_list : null , } , } ; const url = buildURL ( `explore/locations/${ cityId }/` ) ; const response = await HTTP < IPlacesResponse > ( url ) ; const content = response ?. entry_data ?. LocationsDirectoryPage ; if ( content ) { const { city_info = null , country_info = null , location_list = null } = { ... content ?. [ 0 ] } ; result . place . city_info = city_info ; result . place . country_info = country_info ; result . place . location_list = location_list ; } else { throw new Error ( NETWORK_BAN_MESSAGE ) ; } return result ; } ; export default getPlacesByCityId ;