MCPcopy Create free account
hub / github.com/coderkhalide/uber-clone / getTravelTime

Function getTravelTime

app/components/Map.js:34–39  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

32 }, [origin, destination, GOOGLE_MAP_APIKEY])
33
34 const getTravelTime = async () => {
35 const URL = `https://maps.googleapis.com/maps/api/distancematrix/json?units=imperial&origins=${origin.description}&destinations=${destination.description}&key=${GOOGLE_MAP_APIKEY}`
36 const data = await fetch(URL).then(response => response.json())
37 if(data.status !== 'OK') return alert(data.error_message)
38 dispatch(setTravelTimeInformation(data.rows[0].elements[0]))
39 }
40
41 return (
42 <View style={tailwind`flex-1 relative`}>

Callers 1

Map.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected