mirror of
https://github.com/d-fi/d-fi-core.git
synced 2025-07-27 07:34:42 +02:00
update album tracks
This commit is contained in:
parent
7a4152ba33
commit
c2e2434402
10
src/api.ts
10
src/api.ts
@ -62,8 +62,14 @@ export const getAlbumInfo = (alb_id: string): Promise<albumType> => request({alb
|
||||
/**
|
||||
* @param {String} alb_id user id
|
||||
*/
|
||||
export const getAlbumTracks = (alb_id: string): Promise<albumTracksType> =>
|
||||
request({alb_id, lang: 'us', nb: -1}, 'song.getListByAlbum');
|
||||
export const getAlbumTracks = async (alb_id: string): Promise<albumTracksType> => {
|
||||
const albumTracks: albumTracksType = await request({alb_id, lang: 'us', nb: -1}, 'song.getListByAlbum');
|
||||
albumTracks.data = albumTracks.data.map((track, index) => {
|
||||
track.TRACK_POSITION = index + 1;
|
||||
return track;
|
||||
});
|
||||
return albumTracks;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {String} playlist_id playlist id
|
||||
|
@ -105,6 +105,7 @@ interface songType {
|
||||
|
||||
export interface trackType extends songType {
|
||||
FALLBACK?: songType;
|
||||
TRACK_POSITION?: number;
|
||||
}
|
||||
|
||||
export interface albumType {
|
||||
@ -139,7 +140,7 @@ export interface albumType {
|
||||
}
|
||||
|
||||
export interface albumTracksType {
|
||||
data: songType[];
|
||||
data: trackType[];
|
||||
count: number;
|
||||
total: number;
|
||||
filtered_count: number;
|
||||
|
Loading…
x
Reference in New Issue
Block a user