From 38ec216227a792a0ae45f34d8bcd73fcdf4f6098 Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Mon, 15 Jan 2024 16:28:52 +0530 Subject: [PATCH] fix: parse mobile_no if available --- frontend/src/stores/contacts.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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] }