This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//variable to hold the user's access token | |
let accessToken = ''; | |
//some more variables | |
let clientID = ''; | |
let redirectURI = 'http://localhost:3000/'; | |
let url = 'https://accounts.spotify.com/authorize'; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import './SearchBar.css'; | |
class SearchBar extends React.Component { | |
constructor(props) { | |
super(props); | |
this.state = { | |
term: '',//refers to the search term from search input | |
location: '',//refers to the location to search near from input |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import './BusinessList.css'; | |
import Business from '../Business/Business'; | |
class BusinessList extends React.Component { | |
render() { | |
return( | |
<div className="BusinessList"> | |
{ | |
this.props.businesses && this.props.businesses.map(business => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import './Business.css'; | |
class Business extends React.Component { | |
render(){ | |
return( | |
<div className="Business"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import './App.css'; | |
import BusinessList from './components/BusinessList/BusinessList'; | |
import SearchBar from './components/SearchBar/SearchBar'; | |
import Yelp from './util/Yelp'; | |
class App extends React.Component { | |
constructor(props) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Add credentials | |
const apiKey = 'so7zEtdKGsJPkKuyWkfRKL3lNbaWk4N2o8R0-hX1xxg_ZCvNjZ4nJT2fewX3vZNmfFBV55RqhSQhw7CO2QfxcArt-0hxx7y4JGABdE2g-CjJ_4xaPH5aICnzfp16W3Yx'; | |
//Creating a Yelp module | |
const Yelp = { | |
//use this method to retrieve search results from the Yelp API | |
search(term,location,sortBy) { | |
return fetch(`https://cors-anywhere.herokuapp.com/https://api.yelp.com/v3/businesses/search?term=${term}&location=${location}&sort_by=${sortBy}`, { | |
headers: { |