From c1bfd34ec2639b422145535ce9c587d02a3ee50d Mon Sep 17 00:00:00 2001 From: Keshaw Thakur Date: Thu, 1 Oct 2020 09:13:39 +0530 Subject: [PATCH 1/3] Update App.js --- src/App.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/App.js b/src/App.js index bc5adf0..b2cf162 100644 --- a/src/App.js +++ b/src/App.js @@ -6,7 +6,7 @@ import { getTokenFromResponse } from "./spotify"; import "./App.css"; import Login from "./Login"; -const s = new SpotifyWebApi(); +const spotify = new SpotifyWebApi(); function App() { const [{ token }, dispatch] = useStateValue(); @@ -18,21 +18,21 @@ function App() { let _token = hash.access_token; if (_token) { - s.setAccessToken(_token); + spotify.setAccessToken(_token); dispatch({ type: "SET_TOKEN", token: _token, }); - s.getPlaylist("37i9dQZEVXcJZyENOWUFo7").then((response) => + spotify.getPlaylist("37i9dQZEVXcJZyENOWUFo7").then((response) => dispatch({ type: "SET_DISCOVER_WEEKLY", discover_weekly: response, }) ); - s.getMyTopArtists().then((response) => + spotify.getMyTopArtists().then((response) => dispatch({ type: "SET_TOP_ARTISTS", top_artists: response, @@ -41,20 +41,20 @@ function App() { dispatch({ type: "SET_SPOTIFY", - spotify: s, + spotify: spotify, }); - s.getMe().then((user) => { + spotify.getMe().then((user) => { dispatch({ type: "SET_USER", user, }); }); - s.getUserPlaylists().then((playlists) => { + spotify.getUserPlaylists().then((playlists) => { dispatch({ type: "SET_PLAYLISTS", - playlists, + playlists:playlists, }); }); } @@ -63,7 +63,7 @@ function App() { return (
{!token && } - {token && } + {token && }
); } From 9af70b09abb4e0c997b1af73f5bcb48865c13190 Mon Sep 17 00:00:00 2001 From: Keshaw Thakur Date: Thu, 1 Oct 2020 10:10:29 +0530 Subject: [PATCH 2/3] Update Header.js --- src/Header.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/Header.js b/src/Header.js index 13440c9..48f22dc 100644 --- a/src/Header.js +++ b/src/Header.js @@ -3,11 +3,9 @@ import "./Header.css"; import { useStateValue } from "./StateProvider"; import { Avatar } from "@material-ui/core"; import SearchIcon from "@material-ui/icons/Search"; -import { useEffect } from "react"; -function Header({ spotify }) { +function Header() { const [{ user }, dispatch] = useStateValue(); - return (
From 947e5a8f7461f1242d14b2550e3827999f355c97 Mon Sep 17 00:00:00 2001 From: Keshaw Thakur Date: Thu, 1 Oct 2020 10:19:23 +0530 Subject: [PATCH 3/3] Update Login.js --- src/Login.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Login.js b/src/Login.js index 0384408..e27ab8d 100644 --- a/src/Login.js +++ b/src/Login.js @@ -6,7 +6,7 @@ function Login() { return (