major refactors

- add album page store
- show loaders in beforeEnter guards
- show bitrate on now playing card
- etc
This commit is contained in:
geoffrey45
2022-04-03 01:03:32 +03:00
parent 0c1e792839
commit dbb27734fe
26 changed files with 300 additions and 245 deletions
+31
View File
@@ -0,0 +1,31 @@
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;
},
fetchBio(title: string, albumartist: string) {
getAlbumBio(title, albumartist).then((bio) => {
this.bio = bio;
});
},
},
});