mirror of
https://github.com/gotson/komga.git
synced 2025-12-06 08:32:25 +01:00
add missing pagerequest in some queries
This commit is contained in:
parent
ad077c54d0
commit
bd28aef025
6 changed files with 33 additions and 11 deletions
|
|
@ -1,11 +1,11 @@
|
||||||
import { defineQueryOptions } from '@pinia/colada'
|
import { defineQueryOptions } from '@pinia/colada'
|
||||||
import { komgaClient } from '@/api/komga-client'
|
import { komgaClient } from '@/api/komga-client'
|
||||||
import type { components } from '@/generated/openapi/komga'
|
import type { components } from '@/generated/openapi/komga'
|
||||||
|
import type { PageRequest } from '@/types/PageRequest'
|
||||||
|
|
||||||
export const QUERY_KEYS_BOOKS = {
|
export const QUERY_KEYS_BOOKS = {
|
||||||
root: ['books'] as const,
|
root: ['books'] as const,
|
||||||
bySearch: (search: components['schemas']['BookSearch']) =>
|
bySearch: (request: object) => [...QUERY_KEYS_BOOKS.root, JSON.stringify(request)] as const,
|
||||||
[...QUERY_KEYS_BOOKS.root, JSON.stringify(search)] as const,
|
|
||||||
byId: (bookId: string) => [...QUERY_KEYS_BOOKS.root, bookId] as const,
|
byId: (bookId: string) => [...QUERY_KEYS_BOOKS.root, bookId] as const,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -13,15 +13,22 @@ export const bookListQuery = defineQueryOptions(
|
||||||
({
|
({
|
||||||
search,
|
search,
|
||||||
pause = false,
|
pause = false,
|
||||||
|
pageRequest,
|
||||||
}: {
|
}: {
|
||||||
search: components['schemas']['BookSearch']
|
search: components['schemas']['BookSearch']
|
||||||
pause?: boolean
|
pause?: boolean
|
||||||
|
pageRequest?: PageRequest
|
||||||
}) => ({
|
}) => ({
|
||||||
key: QUERY_KEYS_BOOKS.bySearch(search),
|
key: QUERY_KEYS_BOOKS.bySearch({ search: search, pageRequest: pageRequest }),
|
||||||
query: () =>
|
query: () =>
|
||||||
komgaClient
|
komgaClient
|
||||||
.POST('/api/v1/books/list', {
|
.POST('/api/v1/books/list', {
|
||||||
body: search,
|
body: search,
|
||||||
|
params: {
|
||||||
|
query: {
|
||||||
|
...pageRequest,
|
||||||
|
},
|
||||||
|
},
|
||||||
})
|
})
|
||||||
// unwrap the openapi-fetch structure on success
|
// unwrap the openapi-fetch structure on success
|
||||||
.then((res) => res.data),
|
.then((res) => res.data),
|
||||||
|
|
|
||||||
|
|
@ -12,13 +12,17 @@ export const useListReadLists = defineQueryOptions(
|
||||||
({
|
({
|
||||||
search,
|
search,
|
||||||
libraryId,
|
libraryId,
|
||||||
pageable,
|
pageRequest,
|
||||||
}: {
|
}: {
|
||||||
search?: string
|
search?: string
|
||||||
libraryId?: 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: () =>
|
query: () =>
|
||||||
komgaClient
|
komgaClient
|
||||||
.GET('/api/v1/readlists', {
|
.GET('/api/v1/readlists', {
|
||||||
|
|
@ -26,7 +30,7 @@ export const useListReadLists = defineQueryOptions(
|
||||||
query: {
|
query: {
|
||||||
search: search,
|
search: search,
|
||||||
libraryId: libraryId,
|
libraryId: libraryId,
|
||||||
...pageable,
|
...pageRequest,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
import { defineQueryOptions } from '@pinia/colada'
|
import { defineQueryOptions } from '@pinia/colada'
|
||||||
import { komgaClient } from '@/api/komga-client'
|
import { komgaClient } from '@/api/komga-client'
|
||||||
import type { components } from '@/generated/openapi/komga'
|
import type { components } from '@/generated/openapi/komga'
|
||||||
|
import type { PageRequest } from '@/types/PageRequest'
|
||||||
|
|
||||||
export const QUERY_KEYS_SERIES = {
|
export const QUERY_KEYS_SERIES = {
|
||||||
root: ['series'] as const,
|
root: ['series'] as const,
|
||||||
bySearch: (search: components['schemas']['SeriesSearch']) =>
|
bySearch: (request: object) => [...QUERY_KEYS_SERIES.root, JSON.stringify(request)] as const,
|
||||||
[...QUERY_KEYS_SERIES.root, JSON.stringify(search)] as const,
|
|
||||||
byId: (seriesId: string) => [...QUERY_KEYS_SERIES.root, seriesId] as const,
|
byId: (seriesId: string) => [...QUERY_KEYS_SERIES.root, seriesId] as const,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -13,15 +13,22 @@ export const seriesListQuery = defineQueryOptions(
|
||||||
({
|
({
|
||||||
search,
|
search,
|
||||||
pause = false,
|
pause = false,
|
||||||
|
pageRequest,
|
||||||
}: {
|
}: {
|
||||||
search: components['schemas']['SeriesSearch']
|
search: components['schemas']['SeriesSearch']
|
||||||
pause: boolean
|
pause: boolean
|
||||||
|
pageRequest?: PageRequest
|
||||||
}) => ({
|
}) => ({
|
||||||
key: QUERY_KEYS_SERIES.bySearch(search),
|
key: QUERY_KEYS_SERIES.bySearch({ search: search, pageRequest: pageRequest }),
|
||||||
query: () =>
|
query: () =>
|
||||||
komgaClient
|
komgaClient
|
||||||
.POST('/api/v1/series/list', {
|
.POST('/api/v1/series/list', {
|
||||||
body: search,
|
body: search,
|
||||||
|
params: {
|
||||||
|
query: {
|
||||||
|
...pageRequest,
|
||||||
|
},
|
||||||
|
},
|
||||||
})
|
})
|
||||||
// unwrap the openapi-fetch structure on success
|
// unwrap the openapi-fetch structure on success
|
||||||
.then((res) => res.data),
|
.then((res) => res.data),
|
||||||
|
|
|
||||||
|
|
@ -112,6 +112,7 @@ import type { components } from '@/generated/openapi/komga'
|
||||||
import { seriesThumbnailUrl } from '@/api/images'
|
import { seriesThumbnailUrl } from '@/api/images'
|
||||||
import { refDebounced } from '@vueuse/core'
|
import { refDebounced } from '@vueuse/core'
|
||||||
import { useLibraries } from '@/colada/libraries'
|
import { useLibraries } from '@/colada/libraries'
|
||||||
|
import { PageRequest } from '@/types/PageRequest'
|
||||||
|
|
||||||
const showDialog = defineModel<boolean>('dialog', { required: false })
|
const showDialog = defineModel<boolean>('dialog', { required: false })
|
||||||
|
|
||||||
|
|
@ -157,6 +158,7 @@ const {
|
||||||
return {
|
return {
|
||||||
search: search,
|
search: search,
|
||||||
pause: !searchStringDebounced.value,
|
pause: !searchStringDebounced.value,
|
||||||
|
pageRequest: PageRequest.Unpaged(),
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -266,6 +266,7 @@ import { transientBookAnalyze } from '@/colada/transient-books'
|
||||||
import { type ErrorCause, komgaClient } from '@/api/komga-client'
|
import { type ErrorCause, komgaClient } from '@/api/komga-client'
|
||||||
import { commonMessages } from '@/utils/i18n/common-messages'
|
import { commonMessages } from '@/utils/i18n/common-messages'
|
||||||
import { useMessagesStore } from '@/stores/messages'
|
import { useMessagesStore } from '@/stores/messages'
|
||||||
|
import { PageRequest } from '@/types/PageRequest'
|
||||||
|
|
||||||
class BookImport {
|
class BookImport {
|
||||||
transientBook: components['schemas']['TransientBookDto']
|
transientBook: components['schemas']['TransientBookDto']
|
||||||
|
|
@ -550,6 +551,7 @@ function fetchBooks(book: BookImport) {
|
||||||
seriesId: { operator: 'Is', value: book.series!.id },
|
seriesId: { operator: 'Is', value: book.series!.id },
|
||||||
},
|
},
|
||||||
} as components['schemas']['BookSearch'],
|
} as components['schemas']['BookSearch'],
|
||||||
|
pageRequest: PageRequest.Unpaged(),
|
||||||
}))
|
}))
|
||||||
.refresh()
|
.refresh()
|
||||||
.then(({ data }) => {
|
.then(({ data }) => {
|
||||||
|
|
|
||||||
|
|
@ -335,7 +335,7 @@ watchImmediate(
|
||||||
)
|
)
|
||||||
|
|
||||||
//region Duplicate read list name check
|
//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(() =>
|
const readListNameAlreadyExists = computed(() =>
|
||||||
allReadLists.value?.content?.some(
|
allReadLists.value?.content?.some(
|
||||||
(it) => it.name.localeCompare(readListName.value, undefined, { sensitivity: 'accent' }) == 0,
|
(it) => it.name.localeCompare(readListName.value, undefined, { sensitivity: 'accent' }) == 0,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue