feat: allow searching for statuses (#632)
This commit is contained in:
parent
86a604ae9c
commit
12280afe70
7 changed files with 25 additions and 7 deletions
|
@ -111,6 +111,16 @@ export function getStatusRoute(status: Status) {
|
|||
})
|
||||
}
|
||||
|
||||
export function getTagRoute(tag: string) {
|
||||
return useRouter().resolve({
|
||||
name: 'tag',
|
||||
params: {
|
||||
server: currentServer.value,
|
||||
tag,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
export function getStatusPermalinkRoute(status: Status) {
|
||||
return status.url ? withoutProtocol(status.url) : null
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ export interface UseSearchOptions {
|
|||
|
||||
export function useSearch(query: MaybeRef<string>, options?: UseSearchOptions) {
|
||||
const done = ref(false)
|
||||
const masto = useMasto()
|
||||
const loading = ref(false)
|
||||
const statuses = ref<Status[]>([])
|
||||
const accounts = ref<Account[]>([])
|
||||
|
@ -24,7 +25,7 @@ export function useSearch(query: MaybeRef<string>, options?: UseSearchOptions) {
|
|||
* Based on the source it seems like modifying the params when calling next would result in a new search,
|
||||
* but that doesn't seem to be the case. So instead we just create a new paginator with the new params.
|
||||
*/
|
||||
paginator = useMasto().search({ q: unref(query), type: unref(options?.type) })
|
||||
paginator = masto.search({ q: unref(query), resolve: true, type: unref(options?.type) })
|
||||
const nextResults = await paginator.next()
|
||||
|
||||
done.value = nextResults.done || false
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue