fix(Playlist): revert last changes

This commit is contained in:
DevAndromeda 2021-08-11 11:29:36 +05:45
parent f806d1bf85
commit 92565b5f5b
No known key found for this signature in database
GPG key ID: FA40E3EC5CB6DCD6
2 changed files with 3 additions and 3 deletions

View file

@ -116,7 +116,7 @@ class Playlist {
* @param {boolean} [withTracks=true] If it should build json with tracks * @param {boolean} [withTracks=true] If it should build json with tracks
* @returns {PlaylistJSON} * @returns {PlaylistJSON}
*/ */
toJSON(withTracks = false) { toJSON(withTracks = true) {
const payload = { const payload = {
id: this.id, id: this.id,
url: this.url, url: this.url,
@ -129,7 +129,7 @@ class Playlist {
tracks: [] as TrackJSON[] tracks: [] as TrackJSON[]
}; };
if (withTracks) payload.tracks = this.tracks.map((m) => m.toJSON(false)); if (withTracks) payload.tracks = this.tracks.map((m) => m.toJSON(true));
return payload as PlaylistJSON; return payload as PlaylistJSON;
} }

View file

@ -174,7 +174,7 @@ class Track {
durationMS: this.durationMS, durationMS: this.durationMS,
views: this.views, views: this.views,
requestedBy: this.requestedBy.id, requestedBy: this.requestedBy.id,
playlist: hidePlaylist ? null : this.playlist?.toJSON(false) ?? null playlist: hidePlaylist ? null : this.playlist?.toJSON() ?? null
} as TrackJSON; } as TrackJSON;
} }
} }