Просмотр исходного кода

Syntax changes to Kris's Station adjustments

theflametrooper 8 лет назад
Родитель
Сommit
a43788aaaf
4 измененных файлов с 6 добавлено и 10 удалено
  1. 3 5
      backend/logic/actions/stations.js
  2. 1 3
      frontend/App.vue
  3. 1 1
      frontend/components/pages/Home.vue
  4. 1 1
      frontend/main.js

+ 3 - 5
backend/logic/actions/stations.js

@@ -90,7 +90,7 @@ module.exports = {
 				});
 			}
 			let arr = [];
-			for (var prop in stations) {
+			for (let prop in stations) {
 				console.log(prop);
 				arr.push(stations[prop]);
 			}
@@ -181,14 +181,12 @@ module.exports = {
 			}
 
 			if (session) session.stationId = null;
-
-			if (station) {
+			else if (station) {
 				cache.client.hincrby('station.userCounts', stationId, -1, (err, userCount) => {
 					if (err) return cb({ status: 'error', message: 'An error occurred while leaving the station' });
 					cb({ status: 'success', userCount });
 				});
-			}
-			else {
+			} else {
 				cb({ status: 'failure', message: `That station doesn't exist, it may have been deleted` });
 			}
 		});

+ 1 - 3
frontend/App.vue

@@ -36,9 +36,7 @@
 				let socket = this.socket = io(window.location.protocol + '//' + res);
 				socket.on("ready", status => this.loggedIn = status);
 				socket.emit("stations.index", data => {
-					if (data.status === "success") {
-						this.stations = data.stations;
-					}
+					if (data.status === "success") this.stations = data.stations;
 				});
 			});
 		},

+ 1 - 1
frontend/components/pages/Home.vue

@@ -55,7 +55,7 @@
 		<div class="group">
 			<!--<div class="group-title">{{group.name}}</div>-->
 			<div class="group-stations">
-				<div class="stations-station" v-for="station in $parent.stations" v-link="{ path: '/' + station.name }" @click="this.$dispatch('joinStation', station.id)">
+				<div class="stations-station" v-for="station in $parent.stations" v-link="{ path: '/station/' + station.name }" @click="this.$dispatch('joinStation', station.id)">
 					<img class="station-image" :src="station.playlist[station.currentSongIndex].thumbnail" />
 					<div class="station-info">
 						<div class="station-grid-left">

+ 1 - 1
frontend/main.js

@@ -26,7 +26,7 @@ router.map({
 	'/admin': {
 		component: Admin
 	},
-	'/:name': {
+	'/station/:id': {
 		component: Station
 	}
 });