Skip to content

Commit

Permalink
debugging beatbuddy
Browse files Browse the repository at this point in the history
  • Loading branch information
pu098 committed Jan 31, 2024
1 parent f56f7dd commit 83fa86c
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
3 changes: 3 additions & 0 deletions src/beatbuddy/src/spotify/getSong.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ export async function playSong(trackId: string) {

const spotifyClient: SpotifyWebApi = await getSpotifyClient();

const accessToken = spotifyClient.getAccessToken();
console.log('Access Token playSong:', accessToken);

// Retrieve the preview URL for the track
const response = await fetch(`https://api.spotify.com/v1/tracks/${trackId}`, {
headers: {
Expand Down
8 changes: 4 additions & 4 deletions src/beatbuddy/src/spotify/spotifyAuth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ const REDIRECT_URI = process.env.REACT_APP_SPOTIFY_REDIRECT_URI_PROD;

const AUTHORIZATION_ENDPOINT = 'https://accounts.spotify.com/authorize';
const TOKEN_ENDPOINT = 'https://accounts.spotify.com/api/token';
const SCOPE = 'user-read-private \
playlist-modify-public \
playlist-modify-private \
streaming';
const SCOPE = `user-read-private
playlist-modify-public
playlist-modify-private
streaming`;

/**
* Redirects the user to the Spotify Accounts service to authorize access
Expand Down
4 changes: 2 additions & 2 deletions src/components/Navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ function Navbar() {
useEffect(() => {
const checkCookieCleared = () => {
if (!document.cookie.includes('spotify_access_token')) {
console.log('cookie is cleared')
// console.log('cookie is cleared')
setCookieCleared(true);
} else {
console.log('cookie is not cleared')
// console.log('cookie is not cleared')
setCookieCleared(false);
}
};
Expand Down
1 change: 0 additions & 1 deletion src/components/SongResult.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ function SongResult(props: any) {

// This useEffect handles the play/pause btn when users changes song
useEffect(() => {
console.log('currTrackId changes: ' + props.currTrackId);
if (props.currTrackId === props.id) {
setPlayPauseBtn(pause_btn);
} else {
Expand Down

0 comments on commit 83fa86c

Please sign in to comment.