update album tracks

This commit is contained in:
Sayem Chowdhury 2021-03-02 21:37:02 +06:00
parent 7a4152ba33
commit c2e2434402
2 changed files with 10 additions and 3 deletions

View File

@ -62,8 +62,14 @@ export const getAlbumInfo = (alb_id: string): Promise<albumType> => request({alb
/** /**
* @param {String} alb_id user id * @param {String} alb_id user id
*/ */
export const getAlbumTracks = (alb_id: string): Promise<albumTracksType> => export const getAlbumTracks = async (alb_id: string): Promise<albumTracksType> => {
request({alb_id, lang: 'us', nb: -1}, 'song.getListByAlbum'); 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 * @param {String} playlist_id playlist id

View File

@ -105,6 +105,7 @@ interface songType {
export interface trackType extends songType { export interface trackType extends songType {
FALLBACK?: songType; FALLBACK?: songType;
TRACK_POSITION?: number;
} }
export interface albumType { export interface albumType {
@ -139,7 +140,7 @@ export interface albumType {
} }
export interface albumTracksType { export interface albumTracksType {
data: songType[]; data: trackType[];
count: number; count: number;
total: number; total: number;
filtered_count: number; filtered_count: number;