From a4d64191d856e4468055056fffeb0593b60be6ee Mon Sep 17 00:00:00 2001 From: Nikita Krupin Date: Mon, 12 Dec 2022 03:39:45 -0500 Subject: [PATCH] =?UTF-8?q?setting=20X=20icon=20routing=20=F0=9F=92=80dead?= =?UTF-8?q?loop=20fix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- NUXT/components/topNavigation.vue | 42 ++++++++++++++++++++----------- 1 file changed, 27 insertions(+), 15 deletions(-) diff --git a/NUXT/components/topNavigation.vue b/NUXT/components/topNavigation.vue index 833352c..5e7cc13 100644 --- a/NUXT/components/topNavigation.vue +++ b/NUXT/components/topNavigation.vue @@ -64,15 +64,17 @@ icon tile class="ml-4 mr-2 my-auto fill-height rounded-xl" - :style="$route.name !== 'settings' ? '' : 'transform: rotate(180deg)'" + :style="$route.name == 'settings' ? 'transform: rotate(180deg)' : ''" @click=" - $route.path.includes('settings') || $route.path.includes('/tweaks') - ? $router.go(-1) - : $router.push('/settings') + $route.name == 'settings' ? closeSettings() : $router.push('/settings') " > {{ - $route.name !== "settings" ? "mdi-cog-outline" : "mdi-close" + $route.name == "settings" + ? "mdi-close" + : $route.name.includes("mods") + ? "mdi-arrow-left" + : "mdi-cog-outline" }} @@ -93,8 +95,25 @@ export default { events: ["searchBtn", "textChanged", "closeSearch", "scrollToTop"], data: () => ({ text: "", + presettings: false, }), + watch: { + $route(next, prev) { + if (this.$route.path == "/settings" && !prev.name.includes("mods")) { + this.presettings = prev.path; + } + if (this.$route.path == "/search") { + this.text = this.$route.query.q; + } + }, + }, methods: { + closeSettings() { + this.presettings + ? this.$router.push(this.presettings) + : this.$router.go(-1); + this.presettings = false; + }, refreshRecommendations() { this.$emit("scroll-to-top"); @@ -113,18 +132,11 @@ export default { console.log(result); if (result) this.$store.commit("updateRecommendedVideos", [result]); }) - .catch(error => {}); + .catch((error) => { + console.log(error); + }); }, }, - - watch: { - $route() { - if (this.$route.path == "/search") { - this.text = this.$route.query.q; - } - }, - }, - };