Kaynağa Gözat

Changes for merge

Owen Diffey 3 yıl önce
ebeveyn
işleme
0eb1548292

+ 5 - 5
frontend/src/components/modals/ManageStation/Tabs/Playlists.vue

@@ -187,7 +187,7 @@ export default {
 	},
 	mounted() {
 		this.socket.dispatch("playlists.indexMyPlaylists", true, res => {
-			if (res.status === "success") this.playlists = res.data;
+			if (res.status === "success") this.playlists = res.data.playlists;
 			this.orderOfPlaylists = this.calculatePlaylistOrder(); // order in regards to the database
 		});
 
@@ -260,8 +260,8 @@ export default {
 			this.station._id,
 			res => {
 				if (res.status === "success") {
-					this.station.includedPlaylists = res.playlists;
-					this.originalStation.includedPlaylists = res.playlists;
+					this.station.includedPlaylists = res.data.playlists;
+					this.originalStation.includedPlaylists = res.data.playlists;
 				}
 			}
 		);
@@ -271,8 +271,8 @@ export default {
 			this.station._id,
 			res => {
 				if (res.status === "success") {
-					this.station.excludedPlaylists = res.playlists;
-					this.originalStation.excludedPlaylists = res.playlists;
+					this.station.excludedPlaylists = res.data.playlists;
+					this.originalStation.excludedPlaylists = res.data.playlists;
 				}
 			}
 		);

+ 3 - 3
frontend/src/components/modals/ManageStation/Tabs/Settings.vue

@@ -476,12 +476,12 @@ export default {
 					res => {
 						if (res.status === "success") {
 							if (this.originalStation) {
-								this.station.locked = res.data;
-								this.originalStation.locked = res.data;
+								this.station.locked = res.data.locked;
+								this.originalStation.locked = res.data.locked;
 							}
 
 							new Toast(
-								`Toggled queue lock successfully to ${res.data}`
+								`Toggled queue lock successfully to ${res.data.locked}`
 							);
 						} else {
 							new Toast("Failed to toggle queue lock.");

+ 8 - 8
frontend/src/components/modals/ManageStation/Tabs/YoutubeSearch.vue

@@ -94,26 +94,26 @@ export default {
 					"stations.addToQueue",
 					this.station._id,
 					youtubeId,
-					data => {
-						if (data.status !== "success")
-							new Toast(`Error: ${data.message}`);
+					res => {
+						if (res.status !== "success")
+							new Toast(`Error: ${res.message}`);
 						else {
 							this.search.songs.results[
 								index
 							].isAddedToQueue = true;
 
-							new Toast(data.message);
+							new Toast(res.message);
 						}
 					}
 				);
 			} else {
-				this.socket.dispatch("songs.request", youtubeId, data => {
-					if (data.status !== "success")
-						new Toast(`Error: ${data.message}`);
+				this.socket.dispatch("songs.request", youtubeId, res => {
+					if (res.status !== "success")
+						new Toast(`Error: ${res.message}`);
 					else {
 						this.search.songs.results[index].isAddedToQueue = true;
 
-						new Toast(data.message);
+						new Toast(res.message);
 					}
 				});
 			}

+ 15 - 3
frontend/src/components/modals/ManageStation/index.vue

@@ -4,8 +4,6 @@
 			<div class="custom-modal-body" v-if="station && station._id">
 				<div class="left-section">
 					<div class="section tabs-container">
-						<h4 class="section-title">Manage Station</h4>
-						<hr class="section-horizontal-rule" />
 						<div class="tab-selection">
 							<button
 								class="button is-default"
@@ -111,7 +109,7 @@ export default {
 	mounted() {
 		this.socket.dispatch(`stations.getStationById`, this.stationId, res => {
 			if (res.status === "success") {
-				const { station } = res;
+				const { station } = res.data;
 				this.editStation(station);
 			} else {
 				new Toast(`Station with that ID not found${this.stationId}`);
@@ -126,6 +124,20 @@ export default {
 		this.clearStation();
 	},
 	methods: {
+		clearAndRefillStationQueue() {
+			this.socket.dispatch(
+				"stations.clearAndRefillStationQueue",
+				this.station._id,
+				res => {
+					if (res.status !== "success")
+						new Toast({
+							content: `Error: ${res.message}`,
+							timeout: 8000
+						});
+					else new Toast({ content: res.message, timeout: 4000 });
+				}
+			);
+		},
 		...mapActions("modals/editStation", ["editStation", "clearStation"]),
 		...mapActions("modalVisibility", ["closeModal"])
 	}