Skip to content

Commit

Permalink
fix(songs): move revalidation from fetch to export
Browse files Browse the repository at this point in the history
  • Loading branch information
chimpdev committed Nov 6, 2024
1 parent e1e2b8b commit d09879c
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions components/songs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import getNewAccessToken from '@/utils/getSpotifyAccessToken';
import Image from 'next/image';
import Link from 'next/link';

export const revalidate = 3600;

export default async function Songs() {
if (!process.env.SPOTIFY_CLIENT_ID || !process.env.SPOTIFY_CLIENT_SECRET || !process.env.SPOTIFY_REFRESH_TOKEN) {
console.warn('Environment variables SPOTIFY_CLIENT_ID, SPOTIFY_CLIENT_SECRET, and SPOTIFY_REFRESH_TOKEN are required to render the recently played songs component');
Expand All @@ -18,9 +20,6 @@ export default async function Songs() {
const response = await fetch('https://api.spotify.com/v1/me/player/recently-played?limit=5', {
headers: {
Authorization: `Bearer ${accessToken}`
},
next: {
revalidate: 3600
}
});

Expand Down

0 comments on commit d09879c

Please sign in to comment.