diff --git a/src/components/Main.vue b/src/components/Main.vue index 3000fa7..ed82ffc 100644 --- a/src/components/Main.vue +++ b/src/components/Main.vue @@ -97,10 +97,16 @@ export default { * @param {Object} station Station object */ async doFavor(station) { - if (this.favorites.includes(station.stationuuid)) { + if (this.favorites.flat().includes(station.stationuuid)) { + let stationid = null try { + for (let i = 0, len = this.favorites.length; i < len; i++) { + if (station.stationuuid === this.favorites[i][1]) { + stationid = this.favorites[i][0] + } + } await axios - .delete(generateUrl(`/apps/radio/api/favorites/${station.id}`)) + .delete(generateUrl(`/apps/radio/api/favorites/${stationid}`)) .then(response => { this.favorites = this.favorites.filter(item => item !== station.stationuuid) }) @@ -233,7 +239,7 @@ export default { .then(function(response) { const favorites = [] for (let i = 0, len = response.data.length; i < len; i++) { - favorites.push(response.data[i].stationuuid) + favorites.push([response.data[i].id, response.data[i].stationuuid]) } vm.favorites = favorites }) diff --git a/src/components/Table.vue b/src/components/Table.vue index 95c6da0..59a3738 100644 --- a/src/components/Table.vue +++ b/src/components/Table.vue @@ -21,7 +21,7 @@ height="32" :hash="station.blurHash" :src="station.favicon" /> - +