fix: fetch the first page of data
This commit is contained in:
parent
4139be32f9
commit
cd490fffec
|
@ -14,10 +14,8 @@ export const MentionSuggestion: Partial<SuggestionOptions> = {
|
||||||
if (query.length === 0)
|
if (query.length === 0)
|
||||||
return []
|
return []
|
||||||
|
|
||||||
const mentionPaginator = useMasto().v2.search({ q: query, type: 'accounts', limit: 25, resolve: true })
|
const results = await useMasto().v2.search({ q: query, type: 'accounts', limit: 25, resolve: true })
|
||||||
const results = await mentionPaginator.next()
|
return results.accounts
|
||||||
|
|
||||||
return results.value.accounts
|
|
||||||
},
|
},
|
||||||
render: createSuggestionRenderer(TiptapMentionList),
|
render: createSuggestionRenderer(TiptapMentionList),
|
||||||
}
|
}
|
||||||
|
@ -29,16 +27,14 @@ export const HashtagSuggestion: Partial<SuggestionOptions> = {
|
||||||
if (query.length === 0)
|
if (query.length === 0)
|
||||||
return []
|
return []
|
||||||
|
|
||||||
const paginator = useMasto().v2.search({
|
const results = await useMasto().v2.search({
|
||||||
q: query,
|
q: query,
|
||||||
type: 'hashtags',
|
type: 'hashtags',
|
||||||
limit: 25,
|
limit: 25,
|
||||||
resolve: false,
|
resolve: false,
|
||||||
excludeUnreviewed: true,
|
excludeUnreviewed: true,
|
||||||
})
|
})
|
||||||
const results = await paginator.next()
|
return results.hashtags
|
||||||
|
|
||||||
return results.value.hashtags
|
|
||||||
},
|
},
|
||||||
render: createSuggestionRenderer(TiptapHashtagList),
|
render: createSuggestionRenderer(TiptapHashtagList),
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,9 +53,7 @@ export default defineNuxtRouteMiddleware(async (to, from) => {
|
||||||
await masto.loginTo(currentUser.value)
|
await masto.loginTo(currentUser.value)
|
||||||
|
|
||||||
// If we're logged in, search for the local id the account or status corresponds to
|
// If we're logged in, search for the local id the account or status corresponds to
|
||||||
const { value } = await masto.v2.search({ q: `https:/${to.fullPath}`, resolve: true, limit: 1 }).next()
|
const { accounts, statuses } = await masto.v2.search({ q: `https:/${to.fullPath}`, resolve: true, limit: 1 })
|
||||||
|
|
||||||
const { accounts, statuses } = value
|
|
||||||
if (statuses[0])
|
if (statuses[0])
|
||||||
return getStatusRoute(statuses[0])
|
return getStatusRoute(statuses[0])
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue