Browse Source

Forgot to commit this file last time

Kristian Vos 4 years ago
parent
commit
fc96f8ce76
1 changed files with 42 additions and 4 deletions
  1. 42 4
      frontend/src/components/modals/EditStation.vue

+ 42 - 4
frontend/src/components/modals/EditStation.vue

@@ -524,12 +524,50 @@ export default {
 
 					// this.songDataLoaded = true;
 
-					this.station.genres = JSON.parse(
-						JSON.stringify(this.station.genres)
+					this.socket.emit(
+						`stations.getStationIncludedPlaylistsById`,
+						this.stationId,
+						res => {
+							if (res.status === "success") {
+								this.station.genres = res.playlists.map(
+									playlist => {
+										if (playlist) {
+											if (playlist.type === "genre")
+												return playlist.createdFor;
+											return `Playlist: ${playlist.name}`;
+										}
+										return "Unknown/Error";
+									}
+								);
+							}
+						}
 					);
-					this.station.blacklistedGenres = JSON.parse(
-						JSON.stringify(this.station.blacklistedGenres)
+
+					this.socket.emit(
+						`stations.getStationExcludedPlaylistsById`,
+						this.stationId,
+						res => {
+							if (res.status === "success") {
+								this.station.blacklistedGenres = res.playlists.map(
+									playlist => {
+										if (playlist) {
+											if (playlist.type === "genre")
+												return playlist.createdFor;
+											return `Playlist: ${playlist.name}`;
+										}
+										return "Unknown/Error";
+									}
+								);
+							}
+						}
 					);
+
+					// this.station.genres = JSON.parse(
+					// 	JSON.stringify(this.station.genres)
+					// );
+					// this.station.blacklistedGenres = JSON.parse(
+					// 	JSON.stringify(this.station.blacklistedGenres)
+					// );
 				} else {
 					new Toast({
 						content: "Station with that ID not found",