From cfd20f086cf76737f93d35b6776af3d248d430e4 Mon Sep 17 00:00:00 2001 From: NihadBadalov <32594553+NihadBadalov@users.noreply.github.com> Date: Sat, 17 Feb 2024 19:01:43 +0100 Subject: [PATCH] Feat: Move redirect logic to `onResize` --- src/mixins/mobile.js | 10 ++++++++++ src/pages/List.vue | 5 ----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/mixins/mobile.js b/src/mixins/mobile.js index c44edcff3..283222ead 100644 --- a/src/mixins/mobile.js +++ b/src/mixins/mobile.js @@ -19,6 +19,16 @@ export default { onResize() { this.windowWidth = window.innerWidth; this.updateBody(); + + if (this.$router.currentRoute.value.path === "/dashboard" + || this.$router.currentRoute.value.path === "/list") { + this.$router.push({ + path: this.isMobile + ? "/list" + : "/dashboard", + query: this.$router.currentRoute.value?.query, + }); + } }, /** diff --git a/src/pages/List.vue b/src/pages/List.vue index fc338347c..dd2d46059 100644 --- a/src/pages/List.vue +++ b/src/pages/List.vue @@ -11,11 +11,6 @@ export default { components: { MonitorList, }, - async mounted() { - if (!this.$root.isMobile) { - this.$router.push("/dashboard"); - } - }, };