Update query fetch to support new pagination structure
This commit is contained in:
parent
2043fd3402
commit
6539f90b51
|
@ -5,7 +5,7 @@ import { get } from "svelte/store"
|
||||||
|
|
||||||
export default class QueryFetch extends DataFetch {
|
export default class QueryFetch extends DataFetch {
|
||||||
determineFeatureFlags(definition) {
|
determineFeatureFlags(definition) {
|
||||||
console.log("pagination config", definition?.pagination)
|
console.log("pagination config", definition?.fields?.pagination)
|
||||||
this.supportsPagination =
|
this.supportsPagination =
|
||||||
definition?.fields?.pagination?.type != null &&
|
definition?.fields?.pagination?.type != null &&
|
||||||
definition?.fields?.pagination?.pageParam != null
|
definition?.fields?.pagination?.pageParam != null
|
||||||
|
@ -33,7 +33,7 @@ export default class QueryFetch extends DataFetch {
|
||||||
let queryPayload = { queryId: datasource?._id, parameters }
|
let queryPayload = { queryId: datasource?._id, parameters }
|
||||||
if (this.supportsPagination) {
|
if (this.supportsPagination) {
|
||||||
const { cursor, definition, pageNumber } = get(this.store)
|
const { cursor, definition, pageNumber } = get(this.store)
|
||||||
const { type } = definition.fields.pagination.type
|
const { type } = definition.fields.pagination
|
||||||
const page = type === "page" ? pageNumber : cursor
|
const page = type === "page" ? pageNumber : cursor
|
||||||
queryPayload.pagination = { page, limit }
|
queryPayload.pagination = { page, limit }
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue