From b4c265aa080eecd6bfa6ea6ad3de86ab1024f66c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Ovejero?= Date: Tue, 1 Jun 2021 11:46:38 +0200 Subject: [PATCH] :hammer: Refactor getFields for readability --- packages/nodes-base/nodes/Zoho/GenericFunctions.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/nodes-base/nodes/Zoho/GenericFunctions.ts b/packages/nodes-base/nodes/Zoho/GenericFunctions.ts index bf5ec81541..34b6269b16 100644 --- a/packages/nodes-base/nodes/Zoho/GenericFunctions.ts +++ b/packages/nodes-base/nodes/Zoho/GenericFunctions.ts @@ -296,10 +296,10 @@ export const toLoadOptions = (items: ResourceItems, nameProperty: NameType) => * Retrieve all fields for a resource, sorted alphabetically. */ export async function getFields(this: ILoadOptionsFunctions, resource: SnakeCaseResource) { - const { fields } = await zohoApiRequest.call( - this, 'GET', '/settings/fields', {}, { module: `${resource}s` }, - ) as LoadedFields; - const options = fields.map(({field_label, api_name}) => ({ name: field_label, value: api_name })); + const endpoint = '/settings/fields'; + const qs = { module: `${resource}s` }; + const { fields } = await zohoApiRequest.call(this, 'GET', endpoint, {}, qs) as LoadedFields; + const options = fields.map(({ field_label, api_name }) => ({ name: field_label, value: api_name })); return sortBy(options, o => o.name); }