2022-03-13 14:40:38 +08:00
|
|
|
import request from '@/utils/request'
|
|
|
|
|
|
|
|
export enum AlbumApiNames {
|
|
|
|
FETCH_ALBUM = 'fetchAlbum',
|
|
|
|
}
|
|
|
|
|
|
|
|
// 专辑详情
|
|
|
|
export interface FetchAlbumParams {
|
|
|
|
id: number
|
|
|
|
}
|
2022-03-19 17:03:29 +08:00
|
|
|
export interface FetchAlbumResponse {
|
2022-03-13 14:40:38 +08:00
|
|
|
code: number
|
|
|
|
resourceState: boolean
|
|
|
|
album: Album
|
|
|
|
songs: Track[]
|
|
|
|
description: string
|
|
|
|
}
|
|
|
|
export function fetchAlbum(
|
|
|
|
params: FetchAlbumParams,
|
|
|
|
noCache: boolean
|
|
|
|
): Promise<FetchAlbumResponse> {
|
|
|
|
const otherParams: { timestamp?: number } = {}
|
|
|
|
if (noCache) otherParams.timestamp = new Date().getTime()
|
|
|
|
return request({
|
|
|
|
url: '/album',
|
|
|
|
method: 'get',
|
|
|
|
params: { ...params, ...otherParams },
|
|
|
|
})
|
|
|
|
}
|