Преглед на файлове

fix(Home): really fixed admiFilter keyboard shortcut this time hopefully

Kristian Vos преди 2 години
родител
ревизия
be3ff48eb5
променени са 1 файла, в които са добавени 24 реда и са изтрити 25 реда
  1. 24 25
      frontend/src/pages/Home.vue

+ 24 - 25
frontend/src/pages/Home.vue

@@ -743,6 +743,30 @@ export default {
 		this.socket.on("event:user.orderOfFavoriteStations.updated", res => {
 			this.orderOfFavoriteStations = res.data.order;
 		});
+
+		// ctrl + alt + f
+		keyboardShortcuts.registerShortcut("home.toggleAdminFilter", {
+			keyCode: 70,
+			ctrl: true,
+			alt: true,
+			handler: () => {
+				if (this.isAdmin())
+					if (this.$route.query.adminFilter === undefined)
+						this.$router.push({
+							query: {
+								...this.$route.query,
+								adminFilter: null
+							}
+						});
+					else
+						this.$router.push({
+							query: {
+								...this.$route.query,
+								adminFilter: undefined
+							}
+						});
+			}
+		});
 	},
 	beforeUnmount() {
 		this.socket.dispatch("apis.leaveRoom", "home", () => {});
@@ -785,31 +809,6 @@ export default {
 			);
 
 			this.socket.dispatch("apis.joinRoom", "home");
-
-			if (this.isAdmin()) {
-				// ctrl + alt + f
-				keyboardShortcuts.registerShortcut("home.toggleAdminFilter", {
-					keyCode: 70,
-					ctrl: true,
-					alt: true,
-					handler: () => {
-						if (this.$route.query.adminFilter === undefined)
-							this.$router.push({
-								query: {
-									...this.$route.query,
-									adminFilter: null
-								}
-							});
-						else
-							this.$router.push({
-								query: {
-									...this.$route.query,
-									adminFilter: undefined
-								}
-							});
-					}
-				});
-			}
 		},
 		isOwner(station) {
 			return this.loggedIn && station.owner === this.userId;