фикс initializationInfo - запись поля isLoader

This commit is contained in:
Norbaev 2024-06-27 11:10:07 +05:00
parent 21481aca98
commit 23d25d25fa
2 changed files with 17 additions and 7 deletions

View File

@ -156,8 +156,8 @@ export default {
}, },
}, },
created() { created() {
this.connectionPlayer();
this.initializationInfo(); this.initializationInfo();
this.connectionPlayer();
}, },
mounted() { mounted() {
this.$store.dispatch('initPlayer'); this.$store.dispatch('initPlayer');
@ -189,12 +189,20 @@ export default {
} }
}, },
methods: { methods: {
async initializationInfo() { initializationInfo() {
return app.getNowplaying().then((responce) => { app
console.log(responce.now_playing.song); .getNowplaying()
this.$store.dispatch('setCurrentPlay', responce.now_playing.song); .then((responce) => {
console.log(this.$store.state); console.log(responce.now_playing.song);
}); this.$store.dispatch('setCurrentPlay', {
...this.currentPlay,
isLoader: false,
...responce.now_playing.song,
});
console.log(this.player.target.src);
// console.log(this.$store.state);
})
.catch((error) => console.log(error));
}, },
connectionPlayer() { connectionPlayer() {
@ -237,6 +245,7 @@ export default {
data.np.station.listen_url, data.np.station.listen_url,
); );
this.$store.dispatch('changePlayer', data.np.station.listen_url); this.$store.dispatch('changePlayer', data.np.station.listen_url);
console.log(this.player);
const params = { const params = {
...this.currentPlay, ...this.currentPlay,
...data.np.now_playing.song, ...data.np.now_playing.song,

View File

@ -93,6 +93,7 @@ export default createStore({
state.player.target.pause(); state.player.target.pause();
} }
if (params.play) { if (params.play) {
console.log(state);
if (state.player.target.readyState >= 3) { if (state.player.target.readyState >= 3) {
state.currentPlay.isPlay = true; state.currentPlay.isPlay = true;
state.player.target.play(); state.player.target.play();