From 21481aca98559a1955843aeec799669f87a16935 Mon Sep 17 00:00:00 2001 From: Norbaev Date: Thu, 27 Jun 2024 10:30:37 +0500 Subject: [PATCH] =?UTF-8?q?=D0=BF=D0=BE=D0=BB=D1=83=D1=87=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5=20=D0=B4=D0=B0=D0=BD=D0=BD=D1=8B=D1=85=20=D0=BE=20?= =?UTF-8?q?=D1=82=D1=80=D0=B5=D0=BA=D0=B5=20=D0=BF=D0=B5=D1=80=D0=B5=D0=B4?= =?UTF-8?q?=20=D0=BF=D0=BE=D0=B4=D0=BA=D0=BB=D1=8E=D1=87=D0=B5=D0=BD=D0=B8?= =?UTF-8?q?=D0=B5=D0=BC=20=D1=81=D1=82=D1=80=D0=B8=D0=BC=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/src/components/player.vue | 11 +++++++++-- client/src/services/audio.js | 4 ++-- client/src/settings/index.js | 1 - client/src/store/index.js | 2 ++ 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/client/src/components/player.vue b/client/src/components/player.vue index 709e1bf..6749bc8 100644 --- a/client/src/components/player.vue +++ b/client/src/components/player.vue @@ -157,10 +157,11 @@ export default { }, created() { this.connectionPlayer(); + this.initializationInfo(); }, mounted() { - this.initializationInfo(); this.$store.dispatch('initPlayer'); + // console.log(this.$store.state); if (this.user?.id) { this.checkSongIsFavorite(); this.getSongList(); @@ -189,8 +190,13 @@ export default { }, methods: { async initializationInfo() { - return app.getNowplaying().then((responce) => responce.now_playing.song); + return app.getNowplaying().then((responce) => { + console.log(responce.now_playing.song); + this.$store.dispatch('setCurrentPlay', responce.now_playing.song); + console.log(this.$store.state); + }); }, + connectionPlayer() { if (this.connection) { this.connection.removePlay(); @@ -241,6 +247,7 @@ export default { }; delete params.unique_id; this.$store.dispatch('setCurrentPlay', params); + console.log(this.$store.state); } } } diff --git a/client/src/services/audio.js b/client/src/services/audio.js index ed180db..532793d 100644 --- a/client/src/services/audio.js +++ b/client/src/services/audio.js @@ -57,8 +57,8 @@ export default class extends REST { }; } - onHandler(event) { - this.connection.onmessage = event; + onHandler(callback) { + this.connection.onmessage = callback; } static getPlayList(station, params) { // return this._get(`station/${station}/playlists`, params, {}).then((data) => { diff --git a/client/src/settings/index.js b/client/src/settings/index.js index 705a3fc..39de1f0 100644 --- a/client/src/settings/index.js +++ b/client/src/settings/index.js @@ -41,5 +41,4 @@ const robotsTxt = { }, ], }; -console.log(urlPath); export { selfUrl, ajax, cache, urlPath, urlPathAudio, selfPath, robotsTxt }; diff --git a/client/src/store/index.js b/client/src/store/index.js index 52ed48e..630528b 100644 --- a/client/src/store/index.js +++ b/client/src/store/index.js @@ -62,6 +62,7 @@ export default createStore({ state.player = { ...state.player, ...params }; }, initPlayer(state) { + // console.log('mutation initPlayer', state); state.player.target = document.createElement('audio'); state.player.target.src = ''; state.player.target.preload = 'auto'; @@ -126,6 +127,7 @@ export default createStore({ context.commit('setPlayer', params); }, initPlayer(context) { + // console.log('action initPlayer'); context.commit('initPlayer'); }, handlerPlayer(context, params) {