fix: use lazy pagination (#563)
This commit is contained in:
parent
59d0cfa10e
commit
c8a7e6e7e7
4 changed files with 34 additions and 4 deletions
|
@ -294,6 +294,17 @@ export const createMasto = () => {
|
|||
if (!api.value) {
|
||||
return new Proxy({}, {
|
||||
get(_, subkey) {
|
||||
if (typeof subkey === 'string' && subkey.startsWith('iterate')) {
|
||||
return (...args: any[]) => {
|
||||
let paginator: any
|
||||
function next() {
|
||||
paginator = paginator || (api.value as any)?.[key][subkey](...args)
|
||||
return paginator.next()
|
||||
}
|
||||
return { next }
|
||||
}
|
||||
}
|
||||
|
||||
return (...args: any[]) => apiPromise.value?.then((r: any) => r[key][subkey](...args))
|
||||
},
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue