деструктурировал нужные объекты для предварительной загрузки в initializationInfo()

This commit is contained in:
Norbaev 2024-06-27 17:44:14 +05:00
parent d332dac38f
commit 3da3f39f5a
1 changed files with 7 additions and 5 deletions

View File

@ -161,7 +161,6 @@ export default {
}, },
mounted() { mounted() {
this.$store.dispatch('initPlayer'); this.$store.dispatch('initPlayer');
// console.log(this.$store.state);
if (this.user?.id) { if (this.user?.id) {
this.checkSongIsFavorite(); this.checkSongIsFavorite();
this.getSongList(); this.getSongList();
@ -193,14 +192,15 @@ export default {
app app
.getNowplaying() .getNowplaying()
.then((responce) => { .then((responce) => {
console.log(responce.now_playing.song); const { art, title, artist } = responce.now_playing.song;
this.$store.dispatch('setCurrentPlay', { this.$store.dispatch('setCurrentPlay', {
...this.currentPlay, ...this.currentPlay,
isLoader: false, isLoader: false,
...responce.now_playing.song, art,
title,
artist,
}); });
console.log(this.player.target.src);
// console.log(this.$store.state);
}) })
.catch((error) => console.log(error)); .catch((error) => console.log(error));
}, },
@ -236,6 +236,7 @@ export default {
}, },
getPlaying(e) { getPlaying(e) {
const jsonData = JSON.parse(e.data); const jsonData = JSON.parse(e.data);
if (jsonData?.pub?.data) { if (jsonData?.pub?.data) {
const data = jsonData?.pub?.data; const data = jsonData?.pub?.data;
if (this.currentPlay.live) { if (this.currentPlay.live) {
@ -358,6 +359,7 @@ export default {
app app
.getAudio(id) .getAudio(id)
.then((res) => { .then((res) => {
console.log('res в методе getAudio', res);
const blob = new Blob([res], { type: 'application/audio' }); const blob = new Blob([res], { type: 'application/audio' });
const audioUrl = URL.createObjectURL(blob); const audioUrl = URL.createObjectURL(blob);
this.$store.dispatch('changePlayer', audioUrl); this.$store.dispatch('changePlayer', audioUrl);