mirror of
https://github.com/GiriNeko/YesPlayMusic.git
synced 2025-12-17 13:48:02 +00:00
feat: 增加歌手页面
This commit is contained in:
parent
7d20e6c5de
commit
36603dc3a0
16 changed files with 247 additions and 28 deletions
|
|
@ -1,14 +1,24 @@
|
|||
import { fetchArtist } from '@/api/artist'
|
||||
import { ArtistApiNames } from '@/api/artist'
|
||||
import type { FetchArtistParams } from '@/api/artist'
|
||||
import type { FetchArtistParams, FetchArtistResponse } from '@/api/artist'
|
||||
|
||||
export default function useArtist(params: FetchArtistParams, noCache: boolean) {
|
||||
export default function useArtist(
|
||||
params: FetchArtistParams,
|
||||
noCache?: boolean
|
||||
) {
|
||||
return useQuery(
|
||||
[ArtistApiNames.FETCH_ARTIST, params],
|
||||
() => fetchArtist(params, noCache),
|
||||
() => fetchArtist(params, !!noCache),
|
||||
{
|
||||
enabled: !!params.id && params.id > 0 && !isNaN(Number(params.id)),
|
||||
staleTime: 3600000,
|
||||
staleTime: 5 * 60 * 1000, // 5 mins
|
||||
placeholderData: (): FetchArtistResponse =>
|
||||
window.ipcRenderer.sendSync('getApiCacheSync', {
|
||||
api: 'artists',
|
||||
query: {
|
||||
id: params.id,
|
||||
},
|
||||
}),
|
||||
}
|
||||
)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue