From ae0d90dd99cee80ae572455dc2a07a1afb662c93 Mon Sep 17 00:00:00 2001 From: Rafael Taranto Date: Tue, 16 Jul 2024 09:33:13 +0100 Subject: [PATCH] chore: use map instead of foreach --- .../src/pages/Customers/CustomerData.js | 53 +++++++++---------- 1 file changed, 25 insertions(+), 28 deletions(-) diff --git a/new-lamassu-admin/src/pages/Customers/CustomerData.js b/new-lamassu-admin/src/pages/Customers/CustomerData.js index 55d0f32d..049c0227 100644 --- a/new-lamassu-admin/src/pages/Customers/CustomerData.js +++ b/new-lamassu-admin/src/pages/Customers/CustomerData.js @@ -99,7 +99,6 @@ const CustomerData = ({ const customInfoRequests = sortByName( R.path(['customInfoRequests'])(customer) ?? [] ) - const externalCompliance = [] const phone = R.path(['phone'])(customer) const email = R.path(['email'])(customer) @@ -400,34 +399,32 @@ const CustomerData = ({ }) }, R.keys(smsData) ?? []) - R.forEach(it => { - externalCompliance.push({ - fields: [ - { - name: 'externalId', - label: 'Third Party ID', - editable: false - }, - { - name: 'lastKnownStatus', - label: 'Last Known Status', - editable: false - }, - { - name: 'lastUpdated', - label: 'Last Updated', - editable: false - } - ], - titleIcon: , - title: `External Info [${it.service}]`, - initialValues: it ?? { - externalId: '', - lastKnownStatus: '', - lastUpdated: '' + const externalCompliance = R.map(it => ({ + fields: [ + { + name: 'externalId', + label: 'Third Party ID', + editable: false + }, + { + name: 'lastKnownStatus', + label: 'Last Known Status', + editable: false + }, + { + name: 'lastUpdated', + label: 'Last Updated', + editable: false } - }) - })(customer.externalCompliance ?? []) + ], + titleIcon: , + title: `External Info [${it.service}]`, + initialValues: it ?? { + externalId: '', + lastKnownStatus: '', + lastUpdated: '' + } + }))(customer.externalCompliance ?? []) const editableCard = ( {