mirror of
https://github.com/r-freeman/portfolio.git
synced 2024-11-25 09:55:41 +00:00
Update SpotifyPlayer.tsx
This commit is contained in:
parent
b8ce785bcc
commit
220af5ffa8
@ -110,7 +110,13 @@ type PlayerStateResponse = {
|
||||
}
|
||||
|
||||
function usePlayerState(path: string) {
|
||||
const {data, error, isLoading} = useSWR(`/api/spotify/${path}`, fetcher) as PlayerStateResponse
|
||||
const {data, error, isLoading} = useSWR(`/api/spotify/${path}`, fetcher, {
|
||||
refreshInterval: 3600,
|
||||
revalidateIfStale: true,
|
||||
revalidateOnMount: true,
|
||||
revalidateOnFocus: true,
|
||||
revalidateOnReconnect true
|
||||
}) as PlayerStateResponse
|
||||
|
||||
return {
|
||||
song: data,
|
||||
@ -188,8 +194,6 @@ Song.Skeleton = function SongSkeleton() {
|
||||
)
|
||||
}
|
||||
|
||||
export const revalidate = 0
|
||||
|
||||
export function SpotifyPlayer(): ReactElement | null {
|
||||
const currentlyPlaying = usePlayerState('currently-playing')
|
||||
const lastPlayed = usePlayerState('last-played')
|
||||
|
Loading…
Reference in New Issue
Block a user