From 3efeaa49a4783abb694ac7b691282a9b84720f75 Mon Sep 17 00:00:00 2001 From: Jonas Heinrich Date: Sun, 8 Nov 2020 09:35:08 +0100 Subject: [PATCH] fix showing star on favoring station --- src/components/Main.vue | 16 +++++++++++++--- src/components/Table.vue | 7 +++++-- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/components/Main.vue b/src/components/Main.vue index 43897cf..1ee7abf 100644 --- a/src/components/Main.vue +++ b/src/components/Main.vue @@ -11,6 +11,7 @@ { + this.favorites.push(station.stationuuid) + }) + } catch (error) { showError(t('radio', 'Could not favor station')) } }, @@ -211,9 +216,14 @@ export default { this.$store.dispatch('getVolumeState') }, async loadFavorites() { + const vm = this await axios.get(generateUrl('/apps/radio/api/favorites')) .then(function(response) { - this.favorites = response.data + const favorites = [] + for (let i = 0, len = response.data.length; i < len; i++) { + favorites.push(response.data[i].stationuuid) + } + vm.favorites = favorites }) }, }, diff --git a/src/components/Table.vue b/src/components/Table.vue index 9beff0e..ab2438a 100644 --- a/src/components/Table.vue +++ b/src/components/Table.vue @@ -21,7 +21,7 @@ height="32" :hash="station.blurHash" :src="station.favicon" /> - +
@@ -54,6 +54,10 @@ export default { ActionButton, }, props: { + favorites: { + type: Array, + default() { return [] }, + }, stationData: { type: Array, default() { return [] }, @@ -61,7 +65,6 @@ export default { }, data: () => ({ activeItem: null, - stationsFavored: [1, 2, 3, 4], }), methods: { doPlay(idx, station) {