feat: updates

This commit is contained in:
qier222 2023-01-24 16:29:33 +08:00
parent c6c59b2cd9
commit 7ce516877e
No known key found for this signature in database
63 changed files with 6591 additions and 1107 deletions

View file

@ -1,26 +0,0 @@
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,
}
)
}

View file

@ -1,36 +0,0 @@
import { AppleMusicArtist } from '@/shared/AppleMusic'
import { APIs } from '@/shared/CacheAPIs'
import { IpcChannels } from '@/shared/IpcChannels'
import { useQuery } from '@tanstack/react-query'
export default function useAppleMusicArtist(props: {
id?: number
name?: string
}) {
const { id, name } = props
return useQuery(
['useAppleMusicArtist', props],
async () => {
if (!id || !name) return
const cache = await window.ipcRenderer?.invoke(IpcChannels.GetApiCache, {
api: APIs.AppleMusicArtist,
query: {
id,
},
})
if (cache) return cache
return window.ipcRenderer?.invoke(IpcChannels.GetArtistFromAppleMusic, {
id,
name,
})
},
{
enabled: !!id && !!name,
refetchOnWindowFocus: false,
refetchInterval: false,
}
)
}