mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-05-25 12:04:04 +02:00
enhance(frontend): typed nirax (#16309)
* enhance(frontend): typed nirax * migrate router.replace * fix
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user