YesPlayMusic/packages/web/api/hooks/useAppleMusicArtist.ts

20 lines
452 B
TypeScript
Raw Normal View History

2023-01-24 16:29:33 +08:00
import { useQuery } from '@tanstack/react-query'
import { fetchAppleMusicArtist } from '../appleMusic'
const useAppleMusicArtist = (id: string | number) => {
return useQuery(
['useAppleMusicArtist', id],
async () => {
if (!id) return
return fetchAppleMusicArtist({ neteaseId: id })
},
{
enabled: !!id,
refetchOnWindowFocus: false,
refetchInterval: false,
}
)
}
export default useAppleMusicArtist