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',
},
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',