fix: fix error when attempting to format an invalid phone number string

This commit is contained in:
Liordino Neto 2020-12-18 15:11:15 -03:00 committed by Josh Harvey
parent b1ac484c0b
commit e2970bea48
2 changed files with 7 additions and 5 deletions

View file

@ -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)

View file

@ -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)