From f3ebc4b8537da3263ed6bacd30dc1f9a84ede178 Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Wed, 17 Jan 2024 17:47:42 +0530 Subject: [PATCH] fix: do not parse mobile no if not exist --- 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 8a0071ab..735f9948 100644 --- a/frontend/src/stores/contacts.js +++ b/frontend/src/stores/contacts.js @@ -16,7 +16,7 @@ export const contactsStore = defineStore('crm-contacts', () => { for (let contact of contacts) { // remove special characters from phone number to make it easier to search // also remove spaces but keep + sign at the start - contact.mobile_no = contact.mobile_no.replace(/[^0-9+]/g, '') + contact.mobile_no = contact.mobile_no?.replace(/[^0-9+]/g, '') contactsByPhone[contact.mobile_no] = contact contactsByName[contact.name] = contact } @@ -52,7 +52,7 @@ export const contactsStore = defineStore('crm-contacts', () => { }) function getContact(mobile_no) { - mobile_no = mobile_no.replace(/[^0-9+]/g, '') + mobile_no = mobile_no?.replace(/[^0-9+]/g, '') return contactsByPhone[mobile_no] } function getContactByName(name) {