import { IPlaceResponse , IPlaceResult } from '../types/place-page' ; import { HTTP , buildURL , NETWORK_BAN_MESSAGE } from '../utils' ; example export const getMediaByPlaceId = async ( placeId ) : Promise < IPlaceResult > => { const result = { location : null , } ; const url = buildURL ( `explore/locations/${ placeId }/` ) ; const response = await HTTP < IPlaceResponse > ( url ) ; const content = response ?. entry_data ?. LocationsPage ; if ( content ) { const { location = null } = { ... content ?. [ 0 ] ?. graphql } ; result . location = location ; } else { throw new Error ( NETWORK_BAN_MESSAGE ) ; } return result ; } ; export default getMediaByPlaceId ;