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>
|
2023-11-21 15:25:27 +01:00
|
|
|
<p class="title is-4" v-text="$t('page.spotify.music.new-releases')" />
|
2018-08-11 07:47:10 +02:00
|
|
|
</template>
|
2022-02-19 06:39:14 +01:00
|
|
|
<template #content>
|
2024-03-26 00:59:15 +01:00
|
|
|
<list-albums-spotify :items="new_releases" />
|
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'
|
2024-03-26 00:59:15 +01:00
|
|
|
import ListAlbumsSpotify from '@/components/ListAlbumsSpotify.vue'
|
2018-08-11 07:47:10 +02:00
|
|
|
import SpotifyWebApi from 'spotify-web-api-js'
|
2023-07-18 15:19:24 +02:00
|
|
|
import TabsMusic from '@/components/TabsMusic.vue'
|
2024-04-01 20:42:05 +02:00
|
|
|
import webapi from '@/webapi'
|
2018-08-11 07:47:10 +02:00
|
|
|
|
2022-02-19 06:18:01 +01:00
|
|
|
const dataObject = {
|
2023-06-07 21:25:54 +02:00
|
|
|
load(to) {
|
2024-04-01 20:42:05 +02:00
|
|
|
return webapi.spotify().then(({ data }) => {
|
|
|
|
const spotifyApi = new SpotifyWebApi()
|
|
|
|
spotifyApi.setAccessToken(data.webapi_token)
|
|
|
|
return spotifyApi.getNewReleases({
|
|
|
|
country: data.webapi_country,
|
|
|
|
limit: 50
|
|
|
|
})
|
2022-02-19 06:39:14 +01:00
|
|
|
})
|
2018-08-11 07:47:10 +02:00
|
|
|
},
|
|
|
|
|
2023-06-07 21:25:54 +02:00
|
|
|
set(vm, response) {
|
2024-04-01 20:42:05 +02:00
|
|
|
vm.new_releases = response.albums.items
|
2018-08-11 07:47:10 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default {
|
2023-11-21 15:25:27 +01:00
|
|
|
name: 'PageMusicSpotifyNewReleases',
|
2022-02-19 06:39:14 +01:00
|
|
|
components: {
|
|
|
|
ContentWithHeading,
|
2024-03-26 00:59:15 +01:00
|
|
|
ListAlbumsSpotify,
|
2023-07-12 21:30:52 +02:00
|
|
|
TabsMusic
|
2022-02-19 06:39:14 +01:00
|
|
|
},
|
|
|
|
|
|
|
|
beforeRouteEnter(to, from, next) {
|
|
|
|
dataObject.load(to).then((response) => {
|
|
|
|
next((vm) => dataObject.set(vm, response))
|
|
|
|
})
|
|
|
|
},
|
2018-12-17 11:52:09 +01:00
|
|
|
|
2024-04-01 20:42:05 +02:00
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
new_releases: []
|
2018-08-11 07:47:10 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
2022-02-19 06:39:14 +01:00
|
|
|
<style></style>
|