fix: parse mobile_no if available

This commit is contained in:
Shariq Ansari 2024-01-15 16:28:52 +05:30
parent 059c55ca96
commit 38ec216227

View File

@ -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]
}