diff --git a/frontend/src/stores/contacts.js b/frontend/src/stores/contacts.js index 9e35be3b..8a0071ab 100644 --- a/frontend/src/stores/contacts.js +++ b/frontend/src/stores/contacts.js @@ -38,7 +38,7 @@ export const contactsStore = defineStore('crm-contacts', () => { for (let lead_contact of lead_contacts) { // remove special characters from phone number to make it easier to search // also remove spaces but keep + sign at the start - lead_contact.mobile_no = lead_contact.mobile_no.replace(/[^0-9+]/g, '') + lead_contact.mobile_no = lead_contact.mobile_no?.replace(/[^0-9+]/g, '') lead_contact.full_name = lead_contact.lead_name leadContactsByPhone[lead_contact.mobile_no] = lead_contact } @@ -59,7 +59,7 @@ export const contactsStore = defineStore('crm-contacts', () => { return contactsByName[name] } function getLeadContact(mobile_no) { - mobile_no = mobile_no.replace(/[^0-9+]/g, '') + mobile_no = mobile_no?.replace(/[^0-9+]/g, '') return leadContactsByPhone[mobile_no] }