Closed GregStephen closed 5 years ago
code for the axios call
(`${'https://cors-anywhere.herokuapp.com/'}https://api.yelp.com/v3/businesses/search`,
{
headers: {
Authorization: `Bearer ${yelpKey.YelpKeys.apiKey}`,
},
params: {
term: search,
latitude,
longitude,
},
})
User Story
As a user when I search a term, I should come up with a list of names of business near my location
AC
WHEN the user types in a term such as "pizza" THEN a list of pizza places near by should populate under the search bar
Development
apiKey
and put it into yourapiKeys.json
with a key ofyelpConfig
and a value of an object with a key ofyelpApiKey
and a value of the copied apiKey.apiKeys.example.json
to match but take out the actual apiKey!yelpData.js
file inhelpers/data
and importyelpKeys
fromapiKeys.json
and axios from 'axios'getBusinessesNearMe
that takes in three params (latitude, longitude, search) that is a new Promise that does the axios call found in the commentssearchYelp
function callyelpData.getBusinessesNearMe
and pass in the latitude, longitude and search from this.stateresultComponents
that maps outresults
and with each result makes a<ResultRow key={ result.id } result={ result }/>
<ul>
below the submit button in the return and call{ resultComponents }
ResultRow
component like standardResultRow
create a<li>
and then {this.props.result.name} insideResultRow