feat: upgrade to masto.js v6 (#2530)

This commit is contained in:
patak 2024-01-09 09:56:15 +01:00 committed by GitHub
parent d8ea685803
commit 6c5bb83ac3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
62 changed files with 262 additions and 263 deletions

View file

@ -1,9 +1,9 @@
import type { MaybeRefOrGetter } from '@vueuse/core'
import type { Paginator, mastodon } from 'masto'
import type { mastodon } from 'masto'
import type { RouteLocation } from 'vue-router'
export type UseSearchOptions = MaybeRefOrGetter<
Partial<Omit<mastodon.v1.SearchParams, keyof mastodon.DefaultPaginationParams | 'q'>>
Partial<Omit<mastodon.rest.v2.SearchParams, keyof mastodon.DefaultPaginationParams | 'q'>>
>
export interface BuildSearchResult<K extends keyof any, T> {
@ -30,7 +30,7 @@ export function useSearch(query: MaybeRefOrGetter<string>, options: UseSearchOpt
const q = $computed(() => resolveUnref(query).trim())
let paginator: Paginator<mastodon.v2.Search, mastodon.v2.SearchParams> | undefined
let paginator: mastodon.Paginator<mastodon.v2.Search, mastodon.rest.v2.SearchParams> | undefined
const appendResults = (results: mastodon.v2.Search, empty = false) => {
if (empty) {
@ -72,7 +72,7 @@ export function useSearch(query: MaybeRefOrGetter<string>, options: UseSearchOpt
* 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 = client.v2.search({
paginator = client.v2.search.list({
q,
...resolveUnref(options),
resolve: !!currentUser.value,