diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2020-10-18 10:11:34 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2020-10-18 10:11:34 +0900 |
| commit | 1df7abfbb906f2e364b5eb5fefc5f9de5dd60026 (patch) | |
| tree | 0a72f1f7a559d04e1fc77bfde69c07b23fa47363 /src/client/scripts | |
| parent | ActivityPubでリモートのオブジェクトをGETするときのリクエ... (diff) | |
| download | sharkey-1df7abfbb906f2e364b5eb5fefc5f9de5dd60026.tar.gz sharkey-1df7abfbb906f2e364b5eb5fefc5f9de5dd60026.tar.bz2 sharkey-1df7abfbb906f2e364b5eb5fefc5f9de5dd60026.zip | |
Improve waiting dialog
Diffstat (limited to 'src/client/scripts')
| -rw-r--r-- | src/client/scripts/search.ts | 31 |
1 files changed, 10 insertions, 21 deletions
diff --git a/src/client/scripts/search.ts b/src/client/scripts/search.ts index fbdc32dfb1..540aba2a92 100644 --- a/src/client/scripts/search.ts +++ b/src/client/scripts/search.ts @@ -48,29 +48,18 @@ export async function search(q?: string | null | undefined) { } if (q.startsWith('https://')) { - /* - const dialog = os.dialog({ - type: 'waiting', - text: i18n.global.t('fetchingAsApObject') + '...', - showOkButton: false, - showCancelButton: false, - cancelableByBgClick: false + const promise = os.api('ap/show', { + uri: q }); - */ - try { - const res = await os.api('ap/show', { - uri: q - }); - //dialog.cancel(); - if (res.type === 'User') { - router.push(`/@${res.object.username}@${res.object.host}`); - } else if (res.type === 'Note') { - router.push(`/notes/${res.object.id}`); - } - } catch (e) { - //dialog.cancel(); - // TODO: Show error + os.promiseDialog(promise, null, null, i18n.global.t('fetchingAsApObject')); + + const res = await promise; + + if (res.type === 'User') { + router.push(`/@${res.object.username}@${res.object.host}`); + } else if (res.type === 'Note') { + router.push(`/notes/${res.object.id}`); } return; |