mirror of
https://github.com/GiriNeko/YesPlayMusic.git
synced 2025-12-17 21:58:03 +00:00
feat: updates
This commit is contained in:
parent
a1b0bcf4d3
commit
884f3df41a
198 changed files with 4572 additions and 5336 deletions
|
|
@ -15,20 +15,30 @@ import reactQueryClient from '@/web/utils/reactQueryClient'
|
|||
export default function useUserLikedTracksIDs() {
|
||||
const { data: user } = useUser()
|
||||
const uid = user?.account?.id ?? 0
|
||||
const key = [UserApiNames.FetchUserLikedTracksIds, uid]
|
||||
|
||||
return useQuery(
|
||||
[UserApiNames.FetchUserLikedTracksIds, uid],
|
||||
() => fetchUserLikedTracksIDs({ uid }),
|
||||
key,
|
||||
() => {
|
||||
const existsQueryData = reactQueryClient.getQueryData(key)
|
||||
if (!existsQueryData) {
|
||||
window.ipcRenderer
|
||||
?.invoke(IpcChannels.GetApiCache, {
|
||||
api: APIs.Likelist,
|
||||
query: {
|
||||
uid,
|
||||
},
|
||||
})
|
||||
.then(cache => {
|
||||
if (cache) reactQueryClient.setQueryData(key, cache)
|
||||
})
|
||||
}
|
||||
|
||||
return fetchUserLikedTracksIDs({ uid })
|
||||
},
|
||||
{
|
||||
enabled: !!(uid && uid !== 0),
|
||||
refetchOnWindowFocus: true,
|
||||
placeholderData: (): FetchUserLikedTracksIDsResponse | undefined =>
|
||||
window.ipcRenderer?.sendSync(IpcChannels.GetApiCacheSync, {
|
||||
api: APIs.Likelist,
|
||||
query: {
|
||||
uid,
|
||||
},
|
||||
}),
|
||||
}
|
||||
)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue