Browse Source

Fixed redirecting to / when station is deleted

theflametrooper 7 years ago
parent
commit
35b96fa011

+ 1 - 0
backend/logic/actions/stations.js

@@ -150,6 +150,7 @@ cache.sub('station.voteSkipSong', stationId => {
 });
 
 cache.sub('station.remove', stationId => {
+	utils.emitToRoom(`station.${stationId}`, 'event:stations.remove');
 	utils.emitToRoom('admin.stations', 'event:admin.station.removed', stationId);
 });
 

+ 0 - 1
frontend/components/Modals/EditStation.vue

@@ -158,7 +158,6 @@
 				let _this = this;
 				this.socket.emit('stations.remove', this.editing._id, res => {
 					Toast.methods.addToast(res.message, 8000);
-					if (res.status === 'success' && _this.$parent.station) location.href = '/';
 				});
 			}
 		},

+ 4 - 0
frontend/components/Station/Station.vue

@@ -500,6 +500,10 @@
 					_this.resumeLocalStation();
 				});
 
+				_this.socket.on('event:stations.remove', () => {
+					location.href = '/';
+				});
+
 				_this.socket.on('event:song.like', data => {
 					if (!this.noSong) {
 						if (data.songId === _this.currentSong.songId) {