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 && }
); } 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 (
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 (
LOGIN TO SPOTIFY