Browse Source

Fixed issue with removing songs from the queue

Kristian Vos 4 năm trước cách đây
mục cha
commit
965b46838a
1 tập tin đã thay đổi với 15 bổ sung10 xóa
  1. 15 10
      frontend/src/pages/Station/components/Sidebar/Queue/index.vue

+ 15 - 10
frontend/src/pages/Station/components/Sidebar/Queue/index.vue

@@ -79,7 +79,7 @@
 </template>
 
 <script>
-import { mapActions, mapState } from "vuex";
+import { mapActions, mapState, mapGetters } from "vuex";
 import Toast from "toasters";
 
 import QueueItem from "./QueueItem.vue";
@@ -92,14 +92,19 @@ export default {
 			actionableButtonVisible: false
 		};
 	},
-	computed: mapState({
-		loggedIn: state => state.user.auth.loggedIn,
-		userId: state => state.user.auth.userId,
-		userRole: state => state.user.auth.role,
-		station: state => state.station.station,
-		songsList: state => state.station.songsList,
-		noSong: state => state.station.noSong
-	}),
+	computed: {
+		...mapState({
+			loggedIn: state => state.user.auth.loggedIn,
+			userId: state => state.user.auth.userId,
+			userRole: state => state.user.auth.role,
+			station: state => state.station.station,
+			songsList: state => state.station.songsList,
+			noSong: state => state.station.noSong
+		}),
+		...mapGetters({
+			socket: "websockets/getSocket"
+		})
+	},
 	updated() {
 		// check if actionable button is visible, if not: set max-height of queue items to 100%
 		if (
@@ -118,7 +123,7 @@ export default {
 			return this.loggedIn && this.userRole === "admin";
 		},
 		removeFromQueue(songId) {
-			window.socket.dispatch(
+			this.socket.dispatch(
 				"stations.removeFromQueue",
 				this.station._id,
 				songId,