Skip to content

Instantly share code, notes, and snippets.

View joshmrallen's full-sized avatar

Josh Allen joshmrallen

View GitHub Profile
@joshmrallen
joshmrallen / Spotify.js
Created August 31, 2018 11:35
File from Jammming project where we communicate with the Spotify API to get the access token to allow us to save the User's playlist to their Spotify account.
//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';
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
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 => {
import React from 'react';
import './Business.css';
class Business extends React.Component {
render(){
return(
<div className="Business">
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) {
//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: {