mirror of
https://github.com/GiriNeko/YesPlayMusic.git
synced 2025-12-17 13:48:02 +00:00
chore: 用esbuild代替vite来打包main
This commit is contained in:
parent
b4590c3c34
commit
c4219afd3d
152 changed files with 669 additions and 747 deletions
|
|
@ -1,54 +0,0 @@
|
|||
import { TrackApiNames, fetchAudioSource, fetchTracks } from '@/api/track'
|
||||
import type {
|
||||
FetchAudioSourceParams,
|
||||
FetchTracksParams,
|
||||
FetchTracksResponse,
|
||||
} from '@/api/track'
|
||||
import reactQueryClient from '@/utils/reactQueryClient'
|
||||
|
||||
export default function useTracks(params: FetchTracksParams) {
|
||||
return useQuery(
|
||||
[TrackApiNames.FETCH_TRACKS, params],
|
||||
() => {
|
||||
return fetchTracks(params)
|
||||
},
|
||||
{
|
||||
enabled: params.ids.length !== 0,
|
||||
refetchInterval: false,
|
||||
staleTime: Infinity,
|
||||
initialData: (): FetchTracksResponse | undefined =>
|
||||
window.ipcRenderer.sendSync('getApiCacheSync', {
|
||||
api: 'song/detail',
|
||||
query: {
|
||||
ids: params.ids.join(','),
|
||||
},
|
||||
}),
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
export function fetchTracksWithReactQuery(params: FetchTracksParams) {
|
||||
return reactQueryClient.fetchQuery(
|
||||
[TrackApiNames.FETCH_TRACKS, params],
|
||||
() => {
|
||||
return fetchTracks(params)
|
||||
},
|
||||
{
|
||||
retry: 3,
|
||||
staleTime: 86400000,
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
export function fetchAudioSourceWithReactQuery(params: FetchAudioSourceParams) {
|
||||
return reactQueryClient.fetchQuery(
|
||||
[TrackApiNames.FETCH_AUDIO_SOURCE, params],
|
||||
() => {
|
||||
return fetchAudioSource(params)
|
||||
},
|
||||
{
|
||||
retry: 3,
|
||||
staleTime: 0, // TODO: Web版1小时缓存
|
||||
}
|
||||
)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue