mirror of
https://github.com/r-freeman/portfolio.git
synced 2024-11-14 19:35:41 +00:00
Update SpotifyPlayer
All checks were successful
Build And Publish / BuildAndPublish (push) Successful in 2m39s
All checks were successful
Build And Publish / BuildAndPublish (push) Successful in 2m39s
This commit is contained in:
parent
4bbe6a4ebf
commit
66951af066
@ -1,11 +1,11 @@
|
||||
'use client'
|
||||
|
||||
import useSWR from 'swr'
|
||||
import useSWR, {useSWRConfig} from 'swr'
|
||||
import fetcher from '@/lib/fetcher'
|
||||
import Image from 'next/image'
|
||||
import Link from 'next/link'
|
||||
import clsx from 'clsx'
|
||||
import {useEffect, ReactElement, ElementType} from 'react'
|
||||
import {ElementType, ReactElement, useEffect} from 'react'
|
||||
import {animate} from 'motion'
|
||||
|
||||
type Status = {
|
||||
@ -110,8 +110,11 @@ type PlayerStateResponse = {
|
||||
}
|
||||
|
||||
function usePlayerState(path: string) {
|
||||
const {mutate} = useSWRConfig()
|
||||
const {data, error, isLoading} = useSWR(`/api/spotify/${path}`, fetcher) as PlayerStateResponse
|
||||
|
||||
mutate(`/api/spotify/${path}`, data).then(r => r)
|
||||
|
||||
return {
|
||||
song: data,
|
||||
isLoading,
|
||||
|
Loading…
Reference in New Issue
Block a user