From d2c534243e891b52b972f336037adfea9b0863e6 Mon Sep 17 00:00:00 2001 From: chenos Date: Sun, 10 Oct 2021 12:54:48 +0800 Subject: [PATCH] fix: pageSize to perPage --- packages/client/src/resource.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/client/src/resource.ts b/packages/client/src/resource.ts index daae23661..178ae6384 100644 --- a/packages/client/src/resource.ts +++ b/packages/client/src/resource.ts @@ -21,6 +21,7 @@ export interface SaveOptions { export interface ListOptions { defaultFilter?: any; filter?: any; + pageSize?: number; defaultAppends?: any[]; appends?: string[]; perPage?: number; @@ -53,7 +54,7 @@ export class Resource { } list(options: ListOptions = {}) { - const { defaultAppends = [], appends = [], defaultFilter, filter, ...others } = options; + const { defaultAppends = [], appends = [], defaultFilter, filter, pageSize, ...others } = options; const { associatedKey, associatedName, resourceName } = this.options; let url = `${resourceName}:list`; if (associatedName && associatedKey) { @@ -64,6 +65,7 @@ export class Resource { params: { filter: decodeURIComponent(JSON.stringify({ and: [defaultFilter, filter].filter(Boolean) })), 'fields[appends]': defaultAppends.concat(appends).join(','), + perPage: pageSize, ...others, }, });