mirror of
https://iceshrimp.dev/crimekillz/trashposs
synced 2024-11-25 10:19:06 +01:00
[client] Fix search page behavior in windows
This commit is contained in:
parent
ed6d5d2db6
commit
51065dd170
@ -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)}`);
|
||||
}
|
||||
</script>
|
||||
|
Loading…
Reference in New Issue
Block a user