mirror of
https://github.com/qier222/YesPlayMusic.git
synced 2024-12-02 05:23:39 +08:00
27 lines
619 B
TypeScript
27 lines
619 B
TypeScript
import { IpcChannels } from '@/shared/IpcChannels'
|
|
import { useQuery } from '@tanstack/react-query'
|
|
|
|
export default function useAppleMusicAlbum(props: {
|
|
id?: number
|
|
name?: string
|
|
artist?: string
|
|
}) {
|
|
const { id, name, artist } = props
|
|
return useQuery(
|
|
['useAppleMusicAlbum', props],
|
|
async () => {
|
|
if (!id || !name || !artist) return
|
|
return window.ipcRenderer?.invoke(IpcChannels.GetAlbumFromAppleMusic, {
|
|
id,
|
|
name,
|
|
artist,
|
|
})
|
|
},
|
|
{
|
|
enabled: !!id && !!name && !!artist,
|
|
refetchOnWindowFocus: false,
|
|
refetchInterval: false,
|
|
}
|
|
)
|
|
}
|