further tests with routing

This commit is contained in:
Jonas Heinrich 2020-10-20 16:11:46 +02:00
parent 08d1f95eac
commit d38994f916

View File

@ -49,24 +49,25 @@ export default {
$route: 'onRoute', $route: 'onRoute',
}, },
mounted() { mounted() {
this.loadStations()
this.scroll() this.scroll()
}, },
methods: { methods: {
async onRoute() { async onRoute() {
this.offset = 0
this.tableData = []
const route = this.$route const route = this.$route
switch (route.name) { switch (route.name) {
case this.routes.TOP: case 'TOP':
console.log('new route: TOP') this.loadStations()
break break
case this.routes.RECENT: case 'RECENT':
console.log('new route: RECENT') this.loadStations()
break break
case this.routes.FAVORITES: case 'FAVORITES':
console.log('new route: FAVORITES') this.loadStations()
break break
case this.routes.CATEGORIES: case 'CATEGORIES':
console.log('new route: CATEGORIES') this.loadStations()
break break
} }
}, },
@ -114,8 +115,9 @@ export default {
* Fetching radio stations using Radio-Browser.info API * Fetching radio stations using Radio-Browser.info API
*/ */
loadStations() { loadStations() {
// https://de1.api.radio-browser.info/json/stations/lastchange?limit=10
const vm = this 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, limit: 20,
order: 'clickcount', order: 'clickcount',