Skip to content

Commit

Permalink
Merge pull request #52 from maurodesouza/fix/recently-played
Browse files Browse the repository at this point in the history
🐛  fix: recently spotify played
  • Loading branch information
maurodesouza authored Oct 26, 2023
2 parents 77cef1f + 174cbfe commit ca5464b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
7 changes: 3 additions & 4 deletions src/utils/getMusicUrl/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,10 @@ const { profileBaseUrl, recentlyPlayedBaseUrl } =

const getMusicUrl = (type: string, props: Obj = {}) => {
if (type === 'recently') {
const { user, ...rest } = props;
const username = user as string | undefined;
const spotifyAccountUrl = (props.user &&
`${profileBaseUrl}/${props.user}`) as string | undefined;

const spotifyAccountUrl = username && `${profileBaseUrl}/${username}`;
const imageUrl = `${recentlyPlayedBaseUrl}?${objectToQueryParams(rest)}`;
const imageUrl = `${recentlyPlayedBaseUrl}?${objectToQueryParams(props)}`;

return { spotifyAccountUrl, imageUrl };
}
Expand Down
2 changes: 1 addition & 1 deletion src/utils/getMusicUrl/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ describe('UTILS - Get music url', () => {

expect: {
profileUrl: `${profileBaseUrl}/test`,
imgUrl: `${recentlyPlayedBaseUrl}?foo=some&here=bla`,
imgUrl: `${recentlyPlayedBaseUrl}?user=test&foo=some&here=bla`,
},
},
];
Expand Down

1 comment on commit ca5464b

@vercel
Copy link

@vercel vercel bot commented on ca5464b Oct 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.