chore: 用esbuild代替vite来打包main

This commit is contained in:
qier222 2022-03-29 16:52:53 +08:00
parent b4590c3c34
commit c4219afd3d
No known key found for this signature in database
GPG key ID: 9C85007ED905F14D
152 changed files with 669 additions and 747 deletions

View file

@ -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小时缓存
}
)
}