summaryrefslogtreecommitdiff
path: root/packages/frontend/src/utility
diff options
context:
space:
mode:
authorかっこかり <67428053+kakkokari-gtyih@users.noreply.github.com>2025-07-30 12:30:35 +0900
committerGitHub <noreply@github.com>2025-07-30 12:30:35 +0900
commit4f653f2fbc9f48f2d3069dd587907ebee667386c (patch)
tree7a01cec63c94f56c5da8af3da9356ce74c265def /packages/frontend/src/utility
parentperf(frontend): draw-blurhash workerの結果をpostMessageする際にImageB... (diff)
downloadmisskey-4f653f2fbc9f48f2d3069dd587907ebee667386c.tar.gz
misskey-4f653f2fbc9f48f2d3069dd587907ebee667386c.tar.bz2
misskey-4f653f2fbc9f48f2d3069dd587907ebee667386c.zip
enhance(frontend): typed nirax (#16309)
* enhance(frontend): typed nirax * migrate router.replace * fix
Diffstat (limited to 'packages/frontend/src/utility')
-rw-r--r--packages/frontend/src/utility/get-user-menu.ts13
-rw-r--r--packages/frontend/src/utility/lookup.ts20
2 files changed, 27 insertions, 6 deletions
diff --git a/packages/frontend/src/utility/get-user-menu.ts b/packages/frontend/src/utility/get-user-menu.ts
index ad0864019b..d4407dadec 100644
--- a/packages/frontend/src/utility/get-user-menu.ts
+++ b/packages/frontend/src/utility/get-user-menu.ts
@@ -158,7 +158,11 @@ export function getUserMenu(user: Misskey.entities.UserDetailed, router: Router
icon: 'ti ti-user-exclamation',
text: i18n.ts.moderation,
action: () => {
- router.push(`/admin/user/${user.id}`);
+ router.push('/admin/user/:userId', {
+ params: {
+ userId: user.id,
+ },
+ });
},
}, { type: 'divider' });
}
@@ -216,7 +220,12 @@ export function getUserMenu(user: Misskey.entities.UserDetailed, router: Router
icon: 'ti ti-search',
text: i18n.ts.searchThisUsersNotes,
action: () => {
- router.push(`/search?username=${encodeURIComponent(user.username)}${user.host != null ? '&host=' + encodeURIComponent(user.host) : ''}`);
+ router.push('/search', {
+ query: {
+ username: user.username,
+ host: user.host ?? undefined,
+ },
+ });
},
});
}
diff --git a/packages/frontend/src/utility/lookup.ts b/packages/frontend/src/utility/lookup.ts
index 90611094fa..47d0db125d 100644
--- a/packages/frontend/src/utility/lookup.ts
+++ b/packages/frontend/src/utility/lookup.ts
@@ -19,12 +19,16 @@ export async function lookup(router?: Router) {
if (canceled || query.length <= 1) return;
if (query.startsWith('@') && !query.includes(' ')) {
- _router.push(`/${query}`);
+ _router.pushByPath(`/${query}`);
return;
}
if (query.startsWith('#')) {
- _router.push(`/tags/${encodeURIComponent(query.substring(1))}`);
+ _router.push('/tags/:tag', {
+ params: {
+ tag: query.substring(1),
+ }
+ });
return;
}
@@ -32,9 +36,17 @@ export async function lookup(router?: Router) {
const res = await apLookup(query);
if (res.type === 'User') {
- _router.push(`/@${res.object.username}@${res.object.host}`);
+ _router.push('/@:acct/:page?', {
+ params: {
+ acct: `${res.object.username}@${res.object.host}`,
+ },
+ });
} else if (res.type === 'Note') {
- _router.push(`/notes/${res.object.id}`);
+ _router.push('/notes/:noteId/:initialTab?', {
+ params: {
+ noteId: res.object.id,
+ },
+ });
}
return;