feat: updates

This commit is contained in:
qier222 2022-03-19 17:03:29 +08:00
parent 08abf8229f
commit fb21405bf9
No known key found for this signature in database
GPG key ID: 9C85007ED905F14D
33 changed files with 699 additions and 361 deletions

View file

@ -1,6 +1,6 @@
import { fetchAlbum } from '@/api/album'
import { AlbumApiNames } from '@/api/album'
import type { FetchAlbumParams } from '@/api/album'
import type { FetchAlbumParams, FetchAlbumResponse } from '@/api/album'
import reactQueryClient from '@/utils/reactQueryClient'
const fetch = async (params: FetchAlbumParams, noCache?: boolean) => {
@ -17,7 +17,14 @@ export default function useAlbum(params: FetchAlbumParams, noCache?: boolean) {
() => fetch(params, noCache),
{
enabled: !!params.id,
staleTime: Infinity,
staleTime: 24 * 60 * 60 * 1000, // 24 hours
placeholderData: (): FetchAlbumResponse =>
window.ipcRenderer.sendSync('getApiCacheSync', {
api: 'album',
query: {
id: params.id,
},
}),
}
)
}