import { ILocationResponse , ILocationResult } from '../types/location-page' ; import { HTTP , buildURL , NETWORK_BAN_MESSAGE } from '../utils' ; example export const getMediaByLocation = async ( locationId , placeName ) : Promise < ILocationResult > => { const result = { location : null , } ; const url = buildURL ( `explore/locations/${ locationId }/${ placeName }/` ) ; const response = await HTTP < ILocationResponse > ( 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 getMediaByLocation ;