рефакторинг getPlaying. Добавил кастомное правило в .eslintrc.cjs
This commit is contained in:
parent
15acc8c861
commit
6e1fbf6b16
|
|
@ -83,5 +83,8 @@ module.exports = {
|
||||||
'vue/multi-word-component-names': 'off',
|
'vue/multi-word-component-names': 'off',
|
||||||
// allow debugger during development only
|
// allow debugger during development only
|
||||||
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
|
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
|
||||||
|
|
||||||
|
// Custom
|
||||||
|
'no-console': 'warn',
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -239,20 +239,21 @@ export default {
|
||||||
getPlaying(e) {
|
getPlaying(e) {
|
||||||
// console.log('getPlaying', e);
|
// console.log('getPlaying', e);
|
||||||
const jsonData = JSON.parse(e.data);
|
const jsonData = JSON.parse(e.data);
|
||||||
console.log('jsonData', jsonData);
|
// console.log('jsonData', jsonData);
|
||||||
const data =
|
const data =
|
||||||
// Второй ответ
|
// Второй ответ
|
||||||
jsonData?.pub?.data ||
|
jsonData?.pub?.data ||
|
||||||
// Первый ответ
|
// Первый ответ
|
||||||
jsonData?.connect?.subs?.['station:it-radio']?.publications?.[0]?.data;
|
jsonData?.connect?.subs?.['station:it-radio']?.publications?.[0]?.data;
|
||||||
console.log('getPlaying', data);
|
// console.log('getPlaying', data);
|
||||||
|
|
||||||
if (!data) return;
|
if (!data) return;
|
||||||
if (this.currentPlay.live) {
|
if (this.currentPlay.live) {
|
||||||
const dataUrl = data.np.station.listen_url;
|
const dataUrl = data.np.station.listen_url;
|
||||||
if (data.np.station.listen_url !== this.player.target.src) {
|
const playerUrl = this.player.target.src;
|
||||||
console.log('data.np.station.listen_url', data.np.station.listen_url);
|
if (dataUrl !== playerUrl) {
|
||||||
this.$store.dispatch('changePlayer', data.np.station.listen_url);
|
// console.log('data.np.station.listen_url', dataUrl);
|
||||||
|
this.$store.dispatch('changePlayer', dataUrl);
|
||||||
console.log(this.player);
|
console.log(this.player);
|
||||||
const params = {
|
const params = {
|
||||||
...this.currentPlay,
|
...this.currentPlay,
|
||||||
|
|
@ -262,9 +263,9 @@ export default {
|
||||||
live: true,
|
live: true,
|
||||||
currentIndex: null,
|
currentIndex: null,
|
||||||
};
|
};
|
||||||
|
console.log('params in getPlaying ', params);
|
||||||
delete params.unique_id;
|
delete params.unique_id;
|
||||||
this.$store.dispatch('setCurrentPlay', params);
|
this.$store.dispatch('setCurrentPlay', params);
|
||||||
console.log(this.$store.state);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ export default class extends REST {
|
||||||
sseBaseUri + '?' + sseUriParams.toString(),
|
sseBaseUri + '?' + sseUriParams.toString(),
|
||||||
);
|
);
|
||||||
// window.connection = this.connection;
|
// window.connection = this.connection;
|
||||||
this.connection.onopen = (e) => console.log('connected', e);
|
// this.connection.onopen = (e) => console.log('connected', e);
|
||||||
}
|
}
|
||||||
|
|
||||||
removePlay() {
|
removePlay() {
|
||||||
|
|
@ -66,7 +66,6 @@ export default class extends REST {
|
||||||
// return this._get(`station/${station}/playlists`, params, {}).then((data) => {
|
// return this._get(`station/${station}/playlists`, params, {}).then((data) => {
|
||||||
return this._get(`radio.mp3`, params, {})
|
return this._get(`radio.mp3`, params, {})
|
||||||
.then((data) => {
|
.then((data) => {
|
||||||
console.log(data);
|
|
||||||
return data;
|
return data;
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue