Skip to content

Commit

Permalink
refactor(spotify): make warns errors - rename refresh token env var
Browse files Browse the repository at this point in the history
  • Loading branch information
kieran-osgood committed Oct 24, 2024
1 parent a08e9f1 commit 8e35632
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/pages/api/spotify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const RecentlyPlayedSchema = z.object({

const authOptions = new URLSearchParams({
grant_type: "refresh_token",
refresh_token: import.meta.env.REFRESH_TOKEN,
refresh_token: import.meta.env.SPOTIFY_WEB_API_REFRESH_TOKEN,
});

/**
Expand All @@ -48,7 +48,7 @@ const GET: APIRoute & {
.then((response) => TokenSchema.safeParse(response));

if (!tokenResponse.success) {
console.warn("Retrieve token failed: ", tokenResponse);
console.error("Retrieve token failed: ", tokenResponse);
return new Response(null, { status: 401 });
}
const url = new URL(RECENTLY_PLAYED_ENDPOINT);
Expand All @@ -65,7 +65,7 @@ const GET: APIRoute & {
.then((response) => RecentlyPlayedSchema.safeParse(response));

if (!recentlyPlayed.success) {
console.warn(
console.error(
"Recently played has changed shape: ",
recentlyPlayed.error.toString(),
);
Expand Down

0 comments on commit 8e35632

Please sign in to comment.