owntone-server/web-src/src/pages/PageRadioStreams.vue

60 lines
1.3 KiB
Vue
Raw Normal View History

<template>
<div>
<content-with-heading>
<template #heading-left>
2022-05-20 13:44:22 +02:00
<p class="title is-4" v-text="$t('page.radio.title')" />
</template>
<template #content>
<p
class="heading has-text-centered-mobile"
v-text="$t('page.radio.count', { count: tracks.total })"
/>
<list-tracks :tracks="tracks" />
</template>
</content-with-heading>
</div>
</template>
<script>
2022-02-19 06:18:01 +01:00
import ContentWithHeading from '@/templates/ContentWithHeading.vue'
import ListTracks from '@/components/ListTracks.vue'
import webapi from '@/webapi'
2023-03-24 04:17:17 +01:00
import { GroupByList } from '@/lib/GroupByList'
2022-02-19 06:18:01 +01:00
const dataObject = {
load: function (to) {
return webapi.library_radio_streams()
},
set: function (vm, response) {
vm.tracks = new GroupByList(response.data.tracks)
}
}
export default {
name: 'PageRadioStreams',
components: { ContentWithHeading, ListTracks },
beforeRouteEnter(to, from, next) {
2022-02-19 06:18:01 +01:00
dataObject.load(to).then((response) => {
next((vm) => dataObject.set(vm, response))
2022-02-19 06:18:01 +01:00
})
},
beforeRouteUpdate(to, from, next) {
2022-02-19 06:18:01 +01:00
const vm = this
dataObject.load(to).then((response) => {
dataObject.set(vm, response)
next()
})
},
data() {
return {
tracks: new GroupByList()
}
}
}
</script>
<style></style>