diff options
| author | syuilo <Syuilotan@yahoo.co.jp> | 2022-06-20 17:38:49 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-06-20 17:38:49 +0900 |
| commit | 699f24f3dcdb156838eb70602885c0b2cdd02cbc (patch) | |
| tree | 45b28eeadbb7d9e7f3847bd04f75ed010153619a /packages/client/src/scripts/search.ts | |
| parent | refactor: チャットルームをComposition API化 (#8850) (diff) | |
| download | sharkey-699f24f3dcdb156838eb70602885c0b2cdd02cbc.tar.gz sharkey-699f24f3dcdb156838eb70602885c0b2cdd02cbc.tar.bz2 sharkey-699f24f3dcdb156838eb70602885c0b2cdd02cbc.zip | |
refactor(client): Refine routing (#8846)
Diffstat (limited to 'packages/client/src/scripts/search.ts')
| -rw-r--r-- | packages/client/src/scripts/search.ts | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/packages/client/src/scripts/search.ts b/packages/client/src/scripts/search.ts index 0aedee9c98..64914d3d65 100644 --- a/packages/client/src/scripts/search.ts +++ b/packages/client/src/scripts/search.ts @@ -1,6 +1,6 @@ import * as os from '@/os'; import { i18n } from '@/i18n'; -import { router } from '@/router'; +import { mainRouter } from '@/router'; export async function search() { const { canceled, result: query } = await os.inputText({ @@ -11,12 +11,12 @@ export async function search() { const q = query.trim(); if (q.startsWith('@') && !q.includes(' ')) { - router.push(`/${q}`); + mainRouter.push(`/${q}`); return; } if (q.startsWith('#')) { - router.push(`/tags/${encodeURIComponent(q.substr(1))}`); + mainRouter.push(`/tags/${encodeURIComponent(q.substr(1))}`); return; } @@ -36,14 +36,14 @@ export async function search() { //v.$root.$emit('warp', date); os.alert({ icon: 'fas fa-history', - iconOnly: true, autoClose: true + iconOnly: true, autoClose: true, }); return; } if (q.startsWith('https://')) { const promise = os.api('ap/show', { - uri: q + uri: q, }); os.promiseDialog(promise, null, null, i18n.ts.fetchingAsApObject); @@ -51,13 +51,13 @@ export async function search() { const res = await promise; if (res.type === 'User') { - router.push(`/@${res.object.username}@${res.object.host}`); + mainRouter.push(`/@${res.object.username}@${res.object.host}`); } else if (res.type === 'Note') { - router.push(`/notes/${res.object.id}`); + mainRouter.push(`/notes/${res.object.id}`); } return; } - router.push(`/search?q=${encodeURIComponent(q)}`); + mainRouter.push(`/search?q=${encodeURIComponent(q)}`); } |