diff --git a/src/views/Main.vue b/src/views/Main.vue index c91b866..cfa0321 100644 --- a/src/views/Main.vue +++ b/src/views/Main.vue @@ -59,8 +59,7 @@ import EmptyContent from '@nextcloud/vue/dist/Components/EmptyContent' import Navigation from './../components/Navigation' import Table from './../components/Table' import Sidebar from './../components/Sidebar' - -import Vuex from 'vuex' +import { mapGetters, mapActions } from 'vuex' import { RadioBrowserApi } from './../services/RadioBrowserApi' const apiClient = new RadioBrowserApi() @@ -80,11 +79,10 @@ export default { blurHashes: require('../assets/blurHashes.json'), showSidebar: false, sidebarStation: {}, - queryParams: {}, tableData: [], }), computed: { - ...Vuex.mapGetters([ + ...mapGetters([ 'favorites', 'recent', 'isFavorite', @@ -97,9 +95,6 @@ export default { } return this.tableData }, - player() { - return this.$store.state.player - }, emptyContentMessage() { if (this.$route.name === 'FAVORITES') { return t('radio', 'No favorites yet') @@ -139,6 +134,12 @@ export default { this.scroll() }, methods: { + ...mapActions([ + 'addFavorite', + 'removeFavorite', + 'addRecent', + 'playStation', + ]), onResize({ width, height }) { const contentHeight = document.getElementById('app-content-vue').scrollHeight @@ -166,9 +167,9 @@ export default { */ async doFavor(station) { if (this.isFavorite(station)) { - this.$store.dispatch('removeFavorite', station) + this.removeFavorite(station) } else { - this.$store.dispatch('addFavorite', station) + this.addFavorite(station) } }, @@ -179,13 +180,13 @@ export default { doPlay(station) { /* Start streaming station */ - this.$store.dispatch('playStation', station) + this.playStation(station) /* Count click */ apiClient.countClick(station) /* Put into recent stations */ - this.$store.dispatch('addRecent', station) + this.addRecent(station) }, @@ -303,6 +304,7 @@ export default { } } }, + toggleSidebar(station = null) { if (station) { this.showSidebar = true @@ -311,6 +313,7 @@ export default { this.showSidebar = false } }, + }, }