add playlist store method to reset banner position

This commit is contained in:
geoffrey45
2023-01-13 16:11:11 +03:00
committed by Mungai Njoroge
parent ceedc22843
commit d60acaa9ef
+5
View File
@@ -21,6 +21,7 @@ export default defineStore("playlist-tracks", {
* @param id The id of the playlist to fetch * @param id The id of the playlist to fetch
*/ */
async fetchAll(id: string) { async fetchAll(id: string) {
this.resetBannerPos();
const playlist = await getPlaylist(id); const playlist = await getPlaylist(id);
this.info = playlist?.info || ({} as Playlist); this.info = playlist?.info || ({} as Playlist);
@@ -43,6 +44,7 @@ export default defineStore("playlist-tracks", {
this.info = info; this.info = info;
this.info = { ...this.info, duration, count }; this.info = { ...this.info, duration, count };
this.bannerPos = this.info.banner_pos;
}, },
plusBannerPos() { plusBannerPos() {
this.bannerPos !== 100 ? (this.bannerPos += 10) : null; this.bannerPos !== 100 ? (this.bannerPos += 10) : null;
@@ -56,6 +58,9 @@ export default defineStore("playlist-tracks", {
resetQuery() { resetQuery() {
this.query = ""; this.query = "";
}, },
resetBannerPos() {
this.bannerPos = 50;
},
}, },
getters: { getters: {
filteredTracks(): ComputedRef<FuseResult[]> { filteredTracks(): ComputedRef<FuseResult[]> {