diff --git a/src/api.ts b/src/api.ts index 6ac361b..6f05dbd 100644 --- a/src/api.ts +++ b/src/api.ts @@ -62,8 +62,14 @@ export const getAlbumInfo = (alb_id: string): Promise => request({alb /** * @param {String} alb_id user id */ -export const getAlbumTracks = (alb_id: string): Promise => - request({alb_id, lang: 'us', nb: -1}, 'song.getListByAlbum'); +export const getAlbumTracks = async (alb_id: string): Promise => { + 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 diff --git a/src/types.ts b/src/types.ts index b375bf7..694528a 100644 --- a/src/types.ts +++ b/src/types.ts @@ -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;