2022-05-12 02:45:43 +08:00
|
|
|
import { fetchUserArtists } from '@/web/api/user'
|
2022-04-16 21:14:03 +08:00
|
|
|
import { UserApiNames, FetchUserArtistsResponse } from '@/shared/api/User'
|
|
|
|
import { APIs } from '@/shared/CacheAPIs'
|
|
|
|
import { IpcChannels } from '@/shared/IpcChannels'
|
2022-05-12 02:45:43 +08:00
|
|
|
import { useQuery } from 'react-query'
|
2022-04-05 02:31:10 +08:00
|
|
|
|
|
|
|
export default function useUserArtists() {
|
2022-04-16 22:39:51 +08:00
|
|
|
return useQuery([UserApiNames.FetchUserArtist], fetchUserArtists, {
|
2022-04-05 23:02:59 +08:00
|
|
|
refetchOnWindowFocus: true,
|
2022-04-05 02:31:10 +08:00
|
|
|
placeholderData: (): FetchUserArtistsResponse =>
|
2022-04-09 00:28:37 +08:00
|
|
|
window.ipcRenderer?.sendSync(IpcChannels.GetApiCacheSync, {
|
2022-04-16 21:14:03 +08:00
|
|
|
api: APIs.UserArtists,
|
2022-04-05 02:31:10 +08:00
|
|
|
}),
|
|
|
|
})
|
|
|
|
}
|