Browse Source

fix(EditSong): (Some?) listeners don't get cleared after exiting the modal

Signed-off-by: Jonathan <theflametrooper@gmail.com>
Jonathan 3 years ago
parent
commit
e29496244a
1 changed files with 45 additions and 21 deletions
  1. 45 21
      frontend/src/components/modals/EditSong.vue

+ 45 - 21
frontend/src/components/modals/EditSong.vue

@@ -856,32 +856,56 @@ export default {
 		localStorage.setItem("volume", volume);
 		this.volumeSliderValue = volume * 100;
 
-		this.socket.on("event:admin.hiddenSong.created", res => {
-			this.song.status = res.data.song.status;
-		});
+		this.socket.on(
+			"event:admin.hiddenSong.created",
+			res => {
+				this.song.status = res.data.song.status;
+			},
+			{ modal: "editSong" }
+		);
 
-		this.socket.on("event:admin.unverifiedSong.created", res => {
-			this.song.status = res.data.song.status;
-		});
+		this.socket.on(
+			"event:admin.unverifiedSong.created",
+			res => {
+				this.song.status = res.data.song.status;
+			},
+			{ modal: "editSong" }
+		);
 
-		this.socket.on("event:admin.verifiedSong.created", res => {
-			this.song.status = res.data.song.status;
-		});
+		this.socket.on(
+			"event:admin.verifiedSong.created",
+			res => {
+				this.song.status = res.data.song.status;
+			},
+			{ modal: "editSong" }
+		);
 
-		this.socket.on("event:admin.hiddenSong.deleted", () => {
-			new Toast("The song you were editing was removed");
-			this.closeModal("editSong");
-		});
+		this.socket.on(
+			"event:admin.hiddenSong.deleted",
+			() => {
+				new Toast("The song you were editing was removed");
+				this.closeModal("editSong");
+			},
+			{ modal: "editSong" }
+		);
 
-		this.socket.on("event:admin.unverifiedSong.deleted", () => {
-			new Toast("The song you were editing was removed");
-			this.closeModal("editSong");
-		});
+		this.socket.on(
+			"event:admin.unverifiedSong.deleted",
+			() => {
+				new Toast("The song you were editing was removed");
+				this.closeModal("editSong");
+			},
+			{ modal: "editSong" }
+		);
 
-		this.socket.on("event:admin.verifiedSong.deleted", () => {
-			new Toast("The song you were editing was removed");
-			this.closeModal("editSong");
-		});
+		this.socket.on(
+			"event:admin.verifiedSong.deleted",
+			() => {
+				new Toast("The song you were editing was removed");
+				this.closeModal("editSong");
+			},
+			{ modal: "editSong" }
+		);
 
 		keyboardShortcuts.registerShortcut("editSong.pauseResumeVideo", {
 			keyCode: 101,