Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -115,6 +115,10 @@ export const useProductPricingStore = defineStore('product-pricing-store', {
|
|||||||
const nextCursorHeader = toText(res?.headers?.['x-next-cursor'])
|
const nextCursorHeader = toText(res?.headers?.['x-next-cursor'])
|
||||||
const data = Array.isArray(res?.data) ? res.data : []
|
const data = Array.isArray(res?.data) ? res.data : []
|
||||||
const mapped = data.map((x, i) => mapRow(x, i, baseIndex))
|
const mapped = data.map((x, i) => mapRow(x, i, baseIndex))
|
||||||
|
const fallbackNextCursor = mapped.length > 0
|
||||||
|
? toText(mapped[mapped.length - 1]?.productCode)
|
||||||
|
: ''
|
||||||
|
const nextCursor = nextCursorHeader || fallbackNextCursor
|
||||||
if (append) {
|
if (append) {
|
||||||
const merged = [...this.rows]
|
const merged = [...this.rows]
|
||||||
const seen = new Set(this.rows.map((x) => x?.productCode))
|
const seen = new Set(this.rows.map((x) => x?.productCode))
|
||||||
@@ -135,13 +139,13 @@ export const useProductPricingStore = defineStore('product-pricing-store', {
|
|||||||
row_count: this.rows.length,
|
row_count: this.rows.length,
|
||||||
fetched_count: mapped.length,
|
fetched_count: mapped.length,
|
||||||
has_more: this.hasMore,
|
has_more: this.hasMore,
|
||||||
next_cursor: nextCursorHeader || null
|
next_cursor: nextCursor || null
|
||||||
})
|
})
|
||||||
return {
|
return {
|
||||||
traceId,
|
traceId,
|
||||||
fetched: mapped.length,
|
fetched: mapped.length,
|
||||||
hasMore: this.hasMore,
|
hasMore: this.hasMore,
|
||||||
nextCursor: nextCursorHeader
|
nextCursor
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
if (!append) this.rows = []
|
if (!append) this.rows = []
|
||||||
|
|||||||
Reference in New Issue
Block a user