2018-08-11 07:47:10 +02:00
|
|
|
<template>
|
2022-02-19 06:18:01 +01:00
|
|
|
<div class="fd-page-with-tabs">
|
2022-02-19 06:39:14 +01:00
|
|
|
<tabs-music />
|
2018-08-11 07:47:10 +02:00
|
|
|
|
|
|
|
<content-with-heading>
|
2022-02-19 06:39:14 +01:00
|
|
|
<template #heading-left>
|
2018-08-11 07:47:10 +02:00
|
|
|
<p class="title is-4">Recently played</p>
|
|
|
|
<p class="heading">tracks</p>
|
|
|
|
</template>
|
2022-02-19 06:39:14 +01:00
|
|
|
<template #content>
|
|
|
|
<list-tracks :tracks="recently_played.items" />
|
2018-08-11 07:47:10 +02:00
|
|
|
</template>
|
|
|
|
</content-with-heading>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2022-02-19 06:18:01 +01:00
|
|
|
import ContentWithHeading from '@/templates/ContentWithHeading.vue'
|
|
|
|
import TabsMusic from '@/components/TabsMusic.vue'
|
|
|
|
import ListTracks from '@/components/ListTracks.vue'
|
2018-08-11 07:47:10 +02:00
|
|
|
import webapi from '@/webapi'
|
|
|
|
|
2022-02-19 06:18:01 +01:00
|
|
|
const dataObject = {
|
2018-08-11 07:47:10 +02:00
|
|
|
load: function (to) {
|
|
|
|
return webapi.search({
|
|
|
|
type: 'track',
|
2022-02-19 06:39:14 +01:00
|
|
|
expression:
|
|
|
|
'time_played after 8 weeks ago and media_kind is music order by time_played desc',
|
2018-08-11 07:47:10 +02:00
|
|
|
limit: 50
|
|
|
|
})
|
|
|
|
},
|
|
|
|
|
|
|
|
set: function (vm, response) {
|
|
|
|
vm.recently_played = response.data.tracks
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'PageBrowseType',
|
2020-10-04 17:31:47 +02:00
|
|
|
components: { ContentWithHeading, TabsMusic, ListTracks },
|
2018-08-11 07:47:10 +02:00
|
|
|
|
2022-02-19 06:39:14 +01:00
|
|
|
beforeRouteEnter(to, from, next) {
|
2022-02-19 06:18:01 +01:00
|
|
|
dataObject.load(to).then((response) => {
|
2022-02-19 06:39:14 +01:00
|
|
|
next((vm) => dataObject.set(vm, response))
|
2022-02-19 06:18:01 +01:00
|
|
|
})
|
|
|
|
},
|
2022-02-19 06:39:14 +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()
|
|
|
|
})
|
2022-02-19 06:39:14 +01:00
|
|
|
},
|
|
|
|
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
recently_played: {}
|
|
|
|
}
|
2018-08-11 07:47:10 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
2022-02-19 06:39:14 +01:00
|
|
|
<style></style>
|