From e2970bea485c3480cd64589366bdbf1e82d3f0ba Mon Sep 17 00:00:00 2001 From: Liordino Neto Date: Fri, 18 Dec 2020 15:11:15 -0300 Subject: [PATCH] fix: fix error when attempting to format an invalid phone number string --- new-lamassu-admin/src/pages/Customers/helper.js | 10 ++++++---- .../src/pages/Wizard/components/OperatorInfo.js | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/new-lamassu-admin/src/pages/Customers/helper.js b/new-lamassu-admin/src/pages/Customers/helper.js index ef22ca72..a698fdd9 100644 --- a/new-lamassu-admin/src/pages/Customers/helper.js +++ b/new-lamassu-admin/src/pages/Customers/helper.js @@ -10,10 +10,12 @@ const getAuthorizedStatus = it => ? { label: `${it.daysSuspended} day suspension`, type: 'warning' } : { label: 'Authorized', type: 'success' } -const getFormattedPhone = (phone, country) => - phone && country - ? parsePhoneNumberFromString(phone, country).formatInternational() - : '' +const getFormattedPhone = (phone, country) => { + const phoneNumber = + phone && country ? parsePhoneNumberFromString(phone, country) : null + + return phoneNumber ? phoneNumber.formatInternational() : phone +} const getName = it => { const idData = R.path(['idCardData'])(it) diff --git a/new-lamassu-admin/src/pages/Wizard/components/OperatorInfo.js b/new-lamassu-admin/src/pages/Wizard/components/OperatorInfo.js index 7fee1aa1..2f51acec 100644 --- a/new-lamassu-admin/src/pages/Wizard/components/OperatorInfo.js +++ b/new-lamassu-admin/src/pages/Wizard/components/OperatorInfo.js @@ -1,8 +1,8 @@ import { makeStyles } from '@material-ui/core' import React from 'react' +import OperatorInfo from 'src/pages/OperatorInfo/OperatorInfo' import styles from 'src/pages/AddMachine/styles' -import OperatorInfo from 'src/pages/OperatorInfo/OperatorInfo' const useStyles = makeStyles(styles)