瀏覽代碼

fix(Manage Station): Socket events being picked up for other stations

Owen Diffey 3 年之前
父節點
當前提交
98bfab321b
共有 1 個文件被更改,包括 18 次插入6 次删除
  1. 18 6
      frontend/src/components/modals/ManageStation/index.vue

+ 18 - 6
frontend/src/components/modals/ManageStation/index.vue

@@ -428,33 +428,45 @@ export default {
 
 		this.socket.on(
 			"event:station.queue.updated",
-			res => this.updateSongsList(res.data.queue),
+			res => {
+				if (res.data.stationId === this.station._id)
+					this.updateSongsList(res.data.queue);
+			},
 			{ modal: "manageStation" }
 		);
 
 		this.socket.on(
 			"event:station.queue.song.repositioned",
-			res => this.repositionSongInList(res.data.song),
+			res => {
+				if (res.data.stationId === this.station._id)
+					this.repositionSongInList(res.data.song);
+			},
 			{ modal: "manageStation" }
 		);
 
 		this.socket.on(
 			"event:station.pause",
-			() => this.updateStationPaused(true),
+			res => {
+				if (res.data.stationId === this.station._id)
+					this.updateStationPaused(true);
+			},
 			{ modal: "manageStation" }
 		);
 
 		this.socket.on(
 			"event:station.resume",
-			() => this.updateStationPaused(false),
+			res => {
+				if (res.data.stationId === this.station._id)
+					this.updateStationPaused(false);
+			},
 			{ modal: "manageStation" }
 		);
 
 		this.socket.on(
 			"event:station.nextSong",
 			res => {
-				const { currentSong } = res.data;
-				this.updateCurrentSong(currentSong || {});
+				if (res.data.stationId === this.station._id)
+					this.updateCurrentSong(res.data.currentSong || {});
 			},
 			{ modal: "manageStation" }
 		);