mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-05 13:03:02 +00:00
attach artist page link to ArtistName component
+ separate fetching artist albums with fetching artist info + include limit when fetching artist albums + refactor interfaces
This commit is contained in:
committed by
Mungai Njoroge
parent
e54fea2d4d
commit
580dce1da9
@@ -1,7 +1,8 @@
|
||||
import { defineStore } from "pinia";
|
||||
|
||||
import { Artist, Album, Track } from "@/interfaces";
|
||||
import { getArtistData } from "@/composables/fetch/artists";
|
||||
import { getArtistData, getArtistAlbums } from "@/composables/fetch/artists";
|
||||
import { maxAbumCards } from "@/stores/content-width";
|
||||
|
||||
export default defineStore("artistPage", {
|
||||
state: () => ({
|
||||
@@ -11,11 +12,23 @@ export default defineStore("artistPage", {
|
||||
}),
|
||||
actions: {
|
||||
async getData(hash: string) {
|
||||
const { artist, albums, tracks } = await getArtistData(hash);
|
||||
const { artist, tracks } = await getArtistData(hash);
|
||||
|
||||
this.info = artist;
|
||||
this.tracks = tracks;
|
||||
this.albums = albums;
|
||||
},
|
||||
async getArtistAlbums() {
|
||||
const albums = await getArtistAlbums(
|
||||
this.info.artisthash,
|
||||
maxAbumCards.value
|
||||
);
|
||||
|
||||
if (albums.length > 0) {
|
||||
this.albums = albums;
|
||||
}
|
||||
},
|
||||
resetAlbums() {
|
||||
this.albums = [];
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user