fix(frontend): 照会処理を統一 (#15536)
* fix(frontend): 照会処理を統一 * fix * doLookup -> apLookup
This commit is contained in:
parent
7fb8fccd57
commit
59567a7ccc
@ -120,6 +120,7 @@ import { i18n } from '@/i18n.js';
|
||||
import { instance } from '@/instance.js';
|
||||
import * as os from '@/os.js';
|
||||
import { misskeyApi } from '@/scripts/misskey-api.js';
|
||||
import { apLookup } from '@/scripts/lookup.js';
|
||||
import { useRouter } from '@/router/supplier.js';
|
||||
import MkButton from '@/components/MkButton.vue';
|
||||
import MkFoldableSection from '@/components/MkFoldableSection.vue';
|
||||
@ -260,13 +261,7 @@ async function search() {
|
||||
text: i18n.ts.lookupConfirm,
|
||||
});
|
||||
if (!confirm.canceled) {
|
||||
const promise = misskeyApi('ap/show', {
|
||||
uri: searchParams.value.query,
|
||||
});
|
||||
|
||||
os.promiseDialog(promise, null, null, i18n.ts.fetchingAsApObject);
|
||||
|
||||
const res = await promise;
|
||||
const res = await apLookup(searchParams.value.query);
|
||||
|
||||
if (res.type === 'User') {
|
||||
router.push(`/@${res.object.username}@${res.object.host}`);
|
||||
|
@ -29,6 +29,19 @@ export async function lookup(router?: Router) {
|
||||
}
|
||||
|
||||
if (query.startsWith('https://')) {
|
||||
const res = await apLookup(query);
|
||||
|
||||
if (res.type === 'User') {
|
||||
_router.push(`/@${res.object.username}@${res.object.host}`);
|
||||
} else if (res.type === 'Note') {
|
||||
_router.push(`/notes/${res.object.id}`);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
export async function apLookup(query: string) {
|
||||
const promise = misskeyApi('ap/show', {
|
||||
uri: query,
|
||||
});
|
||||
@ -67,14 +80,5 @@ export async function lookup(router?: Router) {
|
||||
});
|
||||
}, i18n.ts.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;
|
||||
}
|
||||
return await promise;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user