mirror of
https://github.com/GiriNeko/YesPlayMusic.git
synced 2025-12-17 05:38:04 +00:00
feat: updates
This commit is contained in:
parent
c6c59b2cd9
commit
7ce516877e
63 changed files with 6591 additions and 1107 deletions
|
|
@ -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,
|
||||
}
|
||||
)
|
||||
}
|
||||
|
|
@ -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,
|
||||
}
|
||||
)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue