Browse Source

Fixed small issues with stations and homepage and fixed some indent issues.

KrisVos130 8 years ago
parent
commit
85ef4bd1ff

+ 1 - 1
frontend/components/Admin/Stations.vue

@@ -144,7 +144,7 @@
 			io.getSocket((socket) => {
 				_this.socket = socket;
 				_this.socket.emit('stations.index', data => {
-						_this.stations = data.stations;
+					_this.stations = data.stations;
 				});
 			});
 		}

+ 5 - 5
frontend/components/Modals/Playlists/Edit.vue

@@ -156,7 +156,7 @@
 			io.getSocket((socket) => {
 				_this.socket = socket;
 				_this.socket.emit('playlists.getPlaylist', _this.$parent.playlistBeingEdited, res => {
-						if (res.status == 'success') _this.playlist = res.data; _this.playlist.oldId = res.data._id;
+					if (res.status == 'success') _this.playlist = res.data; _this.playlist.oldId = res.data._id;
 				});
 				_this.socket.on('event:playlist.addSong', (data) => {
 					if (_this.playlist._id === data.playlistId) {
@@ -167,10 +167,10 @@
 				_this.socket.on('event:playlist.removeSong', (data) => {
 					if (_this.playlist._id === data.playlistId) {
 						_this.playlist.songs.forEach((song, index) => {
-						if (song._id === data.songId) {
-							_this.playlist.songs.splice(index, 1);
-						}
-					});
+							if (song._id === data.songId) {
+								_this.playlist.songs.splice(index, 1);
+							}
+						});
 					}
 				});
 				_this.socket.on('event:playlist.updateDisplayName', (data) => {

+ 1 - 1
frontend/components/Sidebars/Playlist.vue

@@ -65,7 +65,7 @@
 					if (res.status == 'success') _this.playlists = res.data;
 				});
 				_this.socket.on('event:playlist.create', (playlist) => {
-						_this.playlists.push(playlist);
+					_this.playlists.push(playlist);
 				});
 				_this.socket.on('event:playlist.delete', (playlistId) => {
 					_this.playlists.forEach((playlist, index) => {

+ 1 - 1
frontend/components/Sidebars/Queue.vue

@@ -51,7 +51,7 @@
 			io.getSocket((socket) => {
 				_this.socket = socket;
 				_this.socket.emit('stations.getPlaylist', _this.$parent.stationId, res => {
-						if (res.status == 'success') _this.playlist = res.data;
+					if (res.status == 'success') _this.playlist = res.data;
 				});
 			});
 		}

+ 1 - 1
frontend/components/Station/Station.vue

@@ -319,7 +319,7 @@
 							owner: res.data.owner,
 							privatePlaylist: res.data.privatePlaylist
 						};
-						_this.currentSong = (res.data.currentSong) ? res.data.currentSong : null;
+						_this.currentSong = (res.data.currentSong) ? res.data.currentSong : {};
 						_this.type = res.data.type;
 						_this.startedAt = res.data.startedAt;
 						_this.paused = res.data.paused;

+ 17 - 16
frontend/components/pages/Home.vue

@@ -107,27 +107,28 @@
 			},
 			init: function() {
 				let _this = this;
-				_this.socket.emit("stations.index", data => {
-					_this.stations.community = [];
-					_this.stations.official = [];
-					if (data.status === "success")  data.stations.forEach(station => {
-						if (!station.currentSong) station.currentSong = { thumbnail: '/assets/notes.png' };
-						console.log(station.privacy);
-						if (station.privacy !== 'public') {
-							console.log(123);
-							station.class = {'station-red': true}
-						} else if (station.type === 'community') {
-							auth.getStatus((authenticated, role, username, userId) => {
+				auth.getStatus((authenticated, role, username, userId) => {
+					_this.socket.emit("stations.index", data => {
+						_this.stations.community = [];
+						_this.stations.official = [];
+						if (data.status === "success")  data.stations.forEach(station => {
+							if (!station.currentSong) station.currentSong = {thumbnail: '/assets/notes.png'};
+							console.log(station.privacy);
+							if (station.privacy !== 'public') {
+								console.log(123);
+								station.class = {'station-red': true}
+							} else if (station.type === 'community') {
 								if (station.owner === userId) {
 									station.class = {'station-blue': true}
 								}
-							});
-						}
-						if (station.type == 'official') _this.stations.official.push(station);
-						else _this.stations.community.push(station);
+							}
+							if (station.type == 'official') _this.stations.official.push(station);
+							else _this.stations.community.push(station);
+						});
+					});
+					_this.socket.emit("apis.joinRoom", 'home', () => {
 					});
 				});
-				_this.socket.emit("apis.joinRoom", 'home', () => {});
 			}
 		},
 		components: { MainHeader, MainFooter }