|
@@ -181,27 +181,26 @@ export default {
|
|
|
const _this = this;
|
|
|
io.getSocket(socket => {
|
|
|
_this.socket = socket;
|
|
|
- if (_this.socket.connected) {
|
|
|
- _this.init();
|
|
|
- _this.socket.on("event:admin.queueSong.added", queueSong => {
|
|
|
- _this.songs.push(queueSong);
|
|
|
- });
|
|
|
- _this.socket.on("event:admin.queueSong.removed", songId => {
|
|
|
- _this.songs = _this.songs.filter(song => {
|
|
|
- return song._id !== songId;
|
|
|
- });
|
|
|
+
|
|
|
+ _this.socket.on("event:admin.queueSong.added", queueSong => {
|
|
|
+ _this.songs.push(queueSong);
|
|
|
+ });
|
|
|
+ _this.socket.on("event:admin.queueSong.removed", songId => {
|
|
|
+ _this.songs = _this.songs.filter(song => {
|
|
|
+ return song._id !== songId;
|
|
|
});
|
|
|
- _this.socket.on(
|
|
|
- "event:admin.queueSong.updated",
|
|
|
- updatedSong => {
|
|
|
- for (let i = 0; i < _this.songs.length; i += 1) {
|
|
|
- const song = _this.songs[i];
|
|
|
- if (song._id === updatedSong._id) {
|
|
|
- _this.songs.$set(i, updatedSong);
|
|
|
- }
|
|
|
- }
|
|
|
+ });
|
|
|
+ _this.socket.on("event:admin.queueSong.updated", updatedSong => {
|
|
|
+ for (let i = 0; i < _this.songs.length; i += 1) {
|
|
|
+ const song = _this.songs[i];
|
|
|
+ if (song._id === updatedSong._id) {
|
|
|
+ _this.songs.$set(i, updatedSong);
|
|
|
}
|
|
|
- );
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ if (_this.socket.connected) {
|
|
|
+ _this.init();
|
|
|
}
|
|
|
io.onConnect(() => {
|
|
|
_this.init();
|