diff --git a/src/library/genre/GenreDetails.vue b/src/library/genre/GenreDetails.vue
index 27d8ad2..7dc7067 100644
--- a/src/library/genre/GenreDetails.vue
+++ b/src/library/genre/GenreDetails.vue
@@ -19,9 +19,9 @@
-
-
-
+
+
+
@@ -29,11 +29,13 @@
import Vue from 'vue'
import AlbumList from '@/library/album/AlbumList.vue'
import TrackList from '@/library/TrackList.vue'
+ import InfiniteList from '@/shared/components/InfiniteList.vue'
export default Vue.extend({
components: {
AlbumList,
TrackList,
+ InfiniteList,
},
props: {
id: { type: String, required: true },
@@ -41,17 +43,18 @@
},
data() {
return {
- albums: null as null | any[],
tracks: null as null | any[],
}
},
created() {
- this.$api.getAlbumsByGenre(this.id).then(result => {
- this.albums = result
- })
this.$api.getTracksByGenre(this.id).then(result => {
this.tracks = result
})
+ },
+ methods: {
+ loadAlbums(offset: number) {
+ return this.$api.getAlbumsByGenre(this.id, 50, offset)
+ }
}
})
diff --git a/src/shared/api.ts b/src/shared/api.ts
index d79a76f..6276597 100644
--- a/src/shared/api.ts
+++ b/src/shared/api.ts
@@ -115,12 +115,12 @@ export class API {
.sort((a: any, b:any) => b.albumCount - a.albumCount)
}
- async getAlbumsByGenre(id: string) {
+ async getAlbumsByGenre(id: string, size: number, offset = 0) {
const params = {
type: 'byGenre',
genre: id,
- count: 500,
- offset: 0,
+ size,
+ offset,
}
const response = await this.get('rest/getAlbumList2', params)
return (response.albumList2?.album || []).map(this.normalizeAlbum, this)
diff --git a/src/shared/components/InfiniteList.vue b/src/shared/components/InfiniteList.vue
new file mode 100644
index 0000000..c3781b2
--- /dev/null
+++ b/src/shared/components/InfiniteList.vue
@@ -0,0 +1,34 @@
+
+
+
+
+
+
+