From 51065dd170e898708290a1a5e6c90f4976702790 Mon Sep 17 00:00:00 2001 From: Laura Hausmann Date: Sun, 19 Nov 2023 16:22:06 +0100 Subject: [PATCH] [client] Fix search page behavior in windows --- packages/client/src/pages/search.vue | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/packages/client/src/pages/search.vue b/packages/client/src/pages/search.vue index 44017a7df..6771d0f7d 100644 --- a/packages/client/src/pages/search.vue +++ b/packages/client/src/pages/search.vue @@ -104,9 +104,11 @@ import "swiper/scss"; import "swiper/scss/virtual"; import {instance} from "@/instance"; import MkSearch from "@/components/MkSearch.vue"; -import { mainRouter } from "@/router.js"; +import { useRouter } from "@/router.js"; import * as os from "@/os.js"; +const router = useRouter(); + const getUrlParams = () => window.location.search .substring(1) @@ -194,12 +196,12 @@ async function search(query: string) { const q = query.trim(); if (q.startsWith("@") && !q.includes(" ")) { - mainRouter.push(`/${q}`); + router.push(`/${q}`); return; } if (q.startsWith("#")) { - mainRouter.push(`/tags/${encodeURIComponent(q.slice(1))}`); + router.push(`/tags/${encodeURIComponent(q.slice(1))}`); return; } @@ -213,15 +215,15 @@ async function search(query: string) { const res = await promise; if (res.type === "User") { - mainRouter.push(`/@${res.object.username}@${res.object.host}`); + router.push(`/@${res.object.username}@${res.object.host}`); } else if (res.type === "Note") { - mainRouter.push(`/notes/${res.object.id}`); + router.push(`/notes/${res.object.id}`); } return; } searchQuery = q; - mainRouter.push(`/search?q=${encodeURIComponent(q)}`); + router.push(`/search?q=${encodeURIComponent(q)}`); }