try this instead

This commit is contained in:
cutestnekoaqua 2023-02-12 00:19:35 +01:00
parent 209cd8a7c8
commit 7ea17df2ba
No known key found for this signature in database
GPG Key ID: 6BF0964A5069C1E0
1 changed files with 3 additions and 3 deletions

View File

@ -70,11 +70,11 @@ export function apiAccountMastodon(router: Router): void {
const accessTokens = ctx.headers.authorization;
const client = getClient(BASE_URL, accessTokens);
try {
const data = await client.searchAccount((ctx.query.acct || '').toString(), {
const data = await client.search((ctx.query.acct || '').toString(), "accounts", {
resolve: true
});
ctx.body = data.data[0];
if (data.data.length === 0) {
ctx.body = data.data.accounts[0];
if (data.data.accounts.length === 0) {
ctx.status = 404;
ctx.body = {
error: `Record (${ctx.query.acct}) not found`