Skip to content

Commit

Permalink
..fixed again
Browse files Browse the repository at this point in the history
  • Loading branch information
s1lvax committed Oct 23, 2024
1 parent 1ed7023 commit ee8e8d2
Showing 1 changed file with 1 addition and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ export const GET = async ({ params }) => {

const { accessToken, refreshToken, expiresAt } = user.spotifyToken;

const refreshedTokens = await refreshSpotifyToken(refreshToken);

// Check if the token is expired, and refresh if necessary
let tokenToUse = accessToken;
if (new Date() > expiresAt) {
Expand All @@ -31,7 +29,7 @@ export const GET = async ({ params }) => {

// Update the tokens in the database
await prisma.spotifyToken.update({
where: { userId: user.id },
where: { userId: user.githubId },
data: {
accessToken: refreshedTokens.access_token,
refreshToken: refreshedTokens.refresh_token || refreshToken,
Expand Down

0 comments on commit ee8e8d2

Please sign in to comment.