2022-03-19 17:03:29 +08:00
|
|
|
import type {
|
|
|
|
FetchUserPlaylistsParams,
|
|
|
|
FetchUserPlaylistsResponse,
|
|
|
|
} from '@/api/user'
|
2022-03-13 14:40:38 +08:00
|
|
|
import { UserApiNames, fetchUserPlaylists } from '@/api/user'
|
|
|
|
|
|
|
|
export default function useUserPlaylists(params: FetchUserPlaylistsParams) {
|
|
|
|
return useQuery(
|
|
|
|
[UserApiNames.FETCH_USER_PLAYLISTS, params],
|
|
|
|
async () => {
|
|
|
|
const data = await fetchUserPlaylists(params)
|
|
|
|
return data
|
|
|
|
},
|
|
|
|
{
|
|
|
|
enabled: !!(
|
|
|
|
!!params.uid &&
|
|
|
|
params.uid !== 0 &&
|
|
|
|
params.offset !== undefined
|
|
|
|
),
|
2022-03-29 16:52:53 +08:00
|
|
|
// placeholderData: (): FetchUserPlaylistsResponse =>
|
|
|
|
// window.ipcRenderer.sendSync('getApiCacheSync', {
|
|
|
|
// api: 'user/playlist',
|
|
|
|
// query: {
|
|
|
|
// uid: params.uid,
|
|
|
|
// },
|
|
|
|
// }),
|
2022-03-13 14:40:38 +08:00
|
|
|
}
|
|
|
|
)
|
|
|
|
}
|