YesPlayMusic/src/renderer/hooks/useUserArtists.ts

14 lines
504 B
TypeScript
Raw Normal View History

2022-04-09 00:28:37 +08:00
import type { FetchUserArtistsResponse } from '@/renderer/api/user'
import { UserApiNames, fetchUserArtists } from '@/renderer/api/user'
import { IpcChannels } from '@/main/IpcChannelsName'
export default function useUserArtists() {
return useQuery([UserApiNames.FETCH_USER_ARTIST], fetchUserArtists, {
refetchOnWindowFocus: true,
placeholderData: (): FetchUserArtistsResponse =>
2022-04-09 00:28:37 +08:00
window.ipcRenderer?.sendSync(IpcChannels.GetApiCacheSync, {
api: 'album/sublist',
}),
})
}