add album view to genre page

This commit is contained in:
Thomas Amland
2020-08-22 11:30:59 +02:00
parent 534f3cf7e1
commit 68d2cebeb1
3 changed files with 51 additions and 13 deletions
+13 -5
View File
@@ -107,17 +107,25 @@ export class API {
.sort((a: any, b:any) => a.name.localeCompare(b.name))
}
async getGenreDetails(id: string) {
async getAlbumsByGenre(id: string) {
const params = {
type: 'byGenre',
genre: id,
count: 500,
offset: 0,
}
const response = await this.get('rest/getAlbumList2', params)
return (response.albumList2?.album || []).map(this.normalizeAlbum, this)
}
async getTracksByGenre(id: string) {
const params = {
genre: id,
count: 500,
offset: 0,
}
const response = await this.get('rest/getSongsByGenre', params)
return {
name: id,
tracks: (response.songsByGenre?.song || []).map(this.normalizeTrack, this),
}
return (response.songsByGenre?.song || []).map(this.normalizeTrack, this)
}
async getArtists(): Promise<Artist[]> {
+1 -1
View File
@@ -69,7 +69,7 @@ export function setupRouter(auth: AuthService) {
},
{
name: 'genre',
path: '/genre/:id',
path: '/genre/:id/:section?',
component: GenreDetails,
props: true,
},