mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-04 04:23:01 +00:00
85c59b4cba
- other minor refactors
33 lines
835 B
TypeScript
33 lines
835 B
TypeScript
import { defineStore } from "pinia";
|
|
import { Track, Artist, AlbumInfo } from "../interfaces";
|
|
import {
|
|
getAlbumTracks,
|
|
getAlbumArtists,
|
|
getAlbumBio,
|
|
} from "../composables/album";
|
|
|
|
export default defineStore("album", {
|
|
state: () => ({
|
|
info: <AlbumInfo>{},
|
|
tracks: <Track[]>[],
|
|
artists: <Artist[]>[],
|
|
bio: null,
|
|
}),
|
|
actions: {
|
|
async fetchTracksAndArtists(title: string, albumartist: string) {
|
|
const tracks = await getAlbumTracks(title, albumartist);
|
|
const artists = await getAlbumArtists(title, albumartist);
|
|
|
|
this.tracks = tracks.tracks;
|
|
this.info = tracks.info;
|
|
this.artists = artists;
|
|
this.bio = null;
|
|
},
|
|
fetchBio(title: string, albumartist: string) {
|
|
getAlbumBio(title, albumartist).then((bio) => {
|
|
this.bio = bio;
|
|
});
|
|
},
|
|
},
|
|
});
|