mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-05 04:53:01 +00:00
add all favorite tracks page
This commit is contained in:
committed by
Mungai Njoroge
parent
108182ab01
commit
22d5f6e896
@@ -0,0 +1,23 @@
|
||||
<template>
|
||||
<SongList :tracks="tracks" :handlePlay="handlePlay" />
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { Ref, ref } from "vue";
|
||||
|
||||
import { Track } from "@/interfaces";
|
||||
import useQueueStore from "@/stores/queue";
|
||||
import { getFavTracks } from "@/composables/fetch/favorite";
|
||||
|
||||
import SongList from "@/components/shared/SongList.vue";
|
||||
|
||||
const tracks: Ref<Track[]> = ref([]);
|
||||
const queue = useQueueStore();
|
||||
|
||||
getFavTracks(0).then((data) => (tracks.value = data));
|
||||
|
||||
function handlePlay(index: number) {
|
||||
queue.playFromFav(tracks.value);
|
||||
queue.play(index);
|
||||
}
|
||||
</script>
|
||||
@@ -11,7 +11,7 @@
|
||||
<div class="fav-tracks" v-if="favTracks.length">
|
||||
<TopTracks
|
||||
:tracks="favTracks"
|
||||
:route="'/home'"
|
||||
:route="'/favorites/tracks'"
|
||||
:title="'Tracks ❤️'"
|
||||
:playHandler="handlePlay"
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user