浏览代码

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;