mirror of
https://github.com/qier222/YesPlayMusic.git
synced 2025-03-01 05:24:26 +08:00
31 lines
852 B
TypeScript
31 lines
852 B
TypeScript
import { fetchArtistMV } from '@/web/api/artist'
|
|
import { IpcChannels } from '@/shared/IpcChannels'
|
|
import { APIs } from '@/shared/CacheAPIs'
|
|
import {
|
|
FetchArtistMVParams,
|
|
ArtistApiNames,
|
|
FetchArtistMVResponse,
|
|
} from '@/shared/api/Artist'
|
|
import { useQuery } from '@tanstack/react-query'
|
|
|
|
export default function useArtistMV(params: FetchArtistMVParams) {
|
|
return useQuery(
|
|
[ArtistApiNames.FetchArtistMV, params],
|
|
async () => {
|
|
const data = await fetchArtistMV(params)
|
|
return data
|
|
},
|
|
{
|
|
enabled: !!params.id && params.id !== 0,
|
|
staleTime: 3600000,
|
|
// placeholderData: (): FetchArtistMVResponse =>
|
|
// window.ipcRenderer?.sendSync(IpcChannels.GetApiCacheSync, {
|
|
// api: APIs.ArtistAlbum,
|
|
// query: {
|
|
// id: params.id,
|
|
// },
|
|
// }),
|
|
}
|
|
)
|
|
}
|