add missing pagerequest in some queries

This commit is contained in:
Gauthier Roebroeck 2025-10-22 10:23:00 +08:00
parent ad077c54d0
commit bd28aef025
6 changed files with 33 additions and 11 deletions

View file

@ -1,11 +1,11 @@
import { defineQueryOptions } from '@pinia/colada'
import { komgaClient } from '@/api/komga-client'
import type { components } from '@/generated/openapi/komga'
import type { PageRequest } from '@/types/PageRequest'
export const QUERY_KEYS_BOOKS = {
root: ['books'] as const,
bySearch: (search: components['schemas']['BookSearch']) =>
[...QUERY_KEYS_BOOKS.root, JSON.stringify(search)] as const,
bySearch: (request: object) => [...QUERY_KEYS_BOOKS.root, JSON.stringify(request)] as const,
byId: (bookId: string) => [...QUERY_KEYS_BOOKS.root, bookId] as const,
}
@ -13,15 +13,22 @@ export const bookListQuery = defineQueryOptions(
({
search,
pause = false,
pageRequest,
}: {
search: components['schemas']['BookSearch']
pause?: boolean
pageRequest?: PageRequest
}) => ({
key: QUERY_KEYS_BOOKS.bySearch(search),
key: QUERY_KEYS_BOOKS.bySearch({ search: search, pageRequest: pageRequest }),
query: () =>
komgaClient
.POST('/api/v1/books/list', {
body: search,
params: {
query: {
...pageRequest,
},
},
})
// unwrap the openapi-fetch structure on success
.then((res) => res.data),

View file

@ -12,13 +12,17 @@ export const useListReadLists = defineQueryOptions(
({
search,
libraryId,
pageable,
pageRequest,
}: {
search?: string
libraryId?: string
pageable?: PageRequest
pageRequest?: PageRequest
}) => ({
key: QUERY_KEYS_READLIST.bySearch({ search: search, libraryId: libraryId, pageable: pageable }),
key: QUERY_KEYS_READLIST.bySearch({
search: search,
libraryId: libraryId,
pageRequest: pageRequest,
}),
query: () =>
komgaClient
.GET('/api/v1/readlists', {
@ -26,7 +30,7 @@ export const useListReadLists = defineQueryOptions(
query: {
search: search,
libraryId: libraryId,
...pageable,
...pageRequest,
},
},
})

View file

@ -1,11 +1,11 @@
import { defineQueryOptions } from '@pinia/colada'
import { komgaClient } from '@/api/komga-client'
import type { components } from '@/generated/openapi/komga'
import type { PageRequest } from '@/types/PageRequest'
export const QUERY_KEYS_SERIES = {
root: ['series'] as const,
bySearch: (search: components['schemas']['SeriesSearch']) =>
[...QUERY_KEYS_SERIES.root, JSON.stringify(search)] as const,
bySearch: (request: object) => [...QUERY_KEYS_SERIES.root, JSON.stringify(request)] as const,
byId: (seriesId: string) => [...QUERY_KEYS_SERIES.root, seriesId] as const,
}
@ -13,15 +13,22 @@ export const seriesListQuery = defineQueryOptions(
({
search,
pause = false,
pageRequest,
}: {
search: components['schemas']['SeriesSearch']
pause: boolean
pageRequest?: PageRequest
}) => ({
key: QUERY_KEYS_SERIES.bySearch(search),
key: QUERY_KEYS_SERIES.bySearch({ search: search, pageRequest: pageRequest }),
query: () =>
komgaClient
.POST('/api/v1/series/list', {
body: search,
params: {
query: {
...pageRequest,
},
},
})
// unwrap the openapi-fetch structure on success
.then((res) => res.data),

View file

@ -112,6 +112,7 @@ import type { components } from '@/generated/openapi/komga'
import { seriesThumbnailUrl } from '@/api/images'
import { refDebounced } from '@vueuse/core'
import { useLibraries } from '@/colada/libraries'
import { PageRequest } from '@/types/PageRequest'
const showDialog = defineModel<boolean>('dialog', { required: false })
@ -157,6 +158,7 @@ const {
return {
search: search,
pause: !searchStringDebounced.value,
pageRequest: PageRequest.Unpaged(),
}
})

View file

@ -266,6 +266,7 @@ import { transientBookAnalyze } from '@/colada/transient-books'
import { type ErrorCause, komgaClient } from '@/api/komga-client'
import { commonMessages } from '@/utils/i18n/common-messages'
import { useMessagesStore } from '@/stores/messages'
import { PageRequest } from '@/types/PageRequest'
class BookImport {
transientBook: components['schemas']['TransientBookDto']
@ -550,6 +551,7 @@ function fetchBooks(book: BookImport) {
seriesId: { operator: 'Is', value: book.series!.id },
},
} as components['schemas']['BookSearch'],
pageRequest: PageRequest.Unpaged(),
}))
.refresh()
.then(({ data }) => {

View file

@ -335,7 +335,7 @@ watchImmediate(
)
//region Duplicate read list name check
const { data: allReadLists } = useQuery(useListReadLists({ pageable: PageRequest.Unpaged() }))
const { data: allReadLists } = useQuery(useListReadLists({ pageRequest: PageRequest.Unpaged() }))
const readListNameAlreadyExists = computed(() =>
allReadLists.value?.content?.some(
(it) => it.name.localeCompare(readListName.value, undefined, { sensitivity: 'accent' }) == 0,