mirror of
https://github.com/GiriNeko/YesPlayMusic.git
synced 2025-12-18 06:07:48 +00:00
feat: updates
This commit is contained in:
parent
ebebf2a733
commit
a1b0bcf4d3
68 changed files with 4776 additions and 5559 deletions
|
|
@ -7,7 +7,7 @@ import {
|
|||
AlbumApiNames,
|
||||
FetchAlbumResponse,
|
||||
} from '@/shared/api/Album'
|
||||
import { useQuery } from '@tanstack/react-query'
|
||||
import { QueryOptions, useQuery } from '@tanstack/react-query'
|
||||
|
||||
const fetch = async (params: FetchAlbumParams) => {
|
||||
const album = await fetchAlbum(params)
|
||||
|
|
@ -23,11 +23,15 @@ const fetchFromCache = (params: FetchAlbumParams): FetchAlbumResponse =>
|
|||
query: params,
|
||||
})
|
||||
|
||||
export default function useAlbum(params: FetchAlbumParams) {
|
||||
export default function useAlbum(
|
||||
params: FetchAlbumParams
|
||||
// queryOptions?: QueryOptions
|
||||
) {
|
||||
return useQuery([AlbumApiNames.FetchAlbum, params], () => fetch(params), {
|
||||
enabled: !!params.id,
|
||||
staleTime: 24 * 60 * 60 * 1000, // 24 hours
|
||||
placeholderData: () => fetchFromCache(params),
|
||||
// ...queryOptions,
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue