Browse Source

fix: fixed issue where stations didn't show 404 page when not found

Kristian Vos 5 years ago
parent
commit
63b7538667
2 changed files with 6 additions and 7 deletions
  1. 4 3
      frontend/components/Station/Station.vue
  2. 2 4
      frontend/main.js

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

@@ -2,7 +2,7 @@
 	<div>
 		<metadata v-bind:title="`${station.displayName}`" />
 
-		<station-header />
+		<station-header v-if="exists" />
 
 		<song-queue v-if="modals.addSongToQueue" />
 		<add-to-playlist v-if="modals.addSongToPlaylist" />
@@ -1010,6 +1010,9 @@ export default {
 						}
 						this.systemDifference = difference;
 					});
+				} else {
+					this.loading = false;
+					this.exists = false;
 				}
 			});
 		},
@@ -1044,8 +1047,6 @@ export default {
 				if (res.status === "failure") {
 					this.loading = false;
 					this.exists = false;
-				} else {
-					this.exists = true;
 				}
 			});
 			this.socket.on("event:songs.next", data => {

+ 2 - 4
frontend/main.js

@@ -155,9 +155,7 @@ router.beforeEach((to, from, next) => {
 				}
 			);
 		}
-	} else next();
-
-	if (to.name === "station") {
+	} else if (to.name === "station") {
 		io.getSocket(socket => {
 			socket.emit("stations.findByName", to.params.id, res => {
 				if (res.status === "success") {
@@ -165,7 +163,7 @@ router.beforeEach((to, from, next) => {
 				}
 			});
 		});
-	}
+	} else next();
 });
 
 // eslint-disable-next-line no-new