From d38994f91668f8aaf82796cb64980e61eef7c650 Mon Sep 17 00:00:00 2001 From: Jonas Heinrich Date: Tue, 20 Oct 2020 16:11:46 +0200 Subject: [PATCH] further tests with routing --- src/components/Main.vue | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/components/Main.vue b/src/components/Main.vue index 3a7900e..69edf89 100644 --- a/src/components/Main.vue +++ b/src/components/Main.vue @@ -49,24 +49,25 @@ export default { $route: 'onRoute', }, mounted() { - this.loadStations() this.scroll() }, methods: { async onRoute() { + this.offset = 0 + this.tableData = [] const route = this.$route switch (route.name) { - case this.routes.TOP: - console.log('new route: TOP') + case 'TOP': + this.loadStations() break - case this.routes.RECENT: - console.log('new route: RECENT') + case 'RECENT': + this.loadStations() break - case this.routes.FAVORITES: - console.log('new route: FAVORITES') + case 'FAVORITES': + this.loadStations() break - case this.routes.CATEGORIES: - console.log('new route: CATEGORIES') + case 'CATEGORIES': + this.loadStations() break } }, @@ -114,8 +115,9 @@ export default { * Fetching radio stations using Radio-Browser.info API */ loadStations() { + // https://de1.api.radio-browser.info/json/stations/lastchange?limit=10 const vm = this - this.$jquery.getJSON('https://de1.api.radio-browser.info/json/stations/search', + this.$jquery.getJSON('https://de1.api.radio-browser.info/json/stations', { limit: 20, order: 'clickcount',