fix: do not reload contact when new contact is created
This commit is contained in:
parent
95661987e8
commit
d37db923a3
@ -236,7 +236,7 @@ async function callInsertDoc() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function handleContactUpdate(doc) {
|
function handleContactUpdate(doc) {
|
||||||
props.contact.reload()
|
props.contact?.reload?.()
|
||||||
if (doc.name && props.options.redirect) {
|
if (doc.name && props.options.redirect) {
|
||||||
router.push({
|
router.push({
|
||||||
name: 'Contact',
|
name: 'Contact',
|
||||||
@ -343,7 +343,7 @@ const sections = computed(() => {
|
|||||||
fields: [
|
fields: [
|
||||||
{
|
{
|
||||||
label: 'Email',
|
label: 'Email',
|
||||||
type: props.contact.data.name ? 'dropdown' : 'data',
|
type: props.contact?.data?.name ? 'dropdown' : 'data',
|
||||||
name: 'email_id',
|
name: 'email_id',
|
||||||
options:
|
options:
|
||||||
props.contact.data?.email_ids?.map((email) => {
|
props.contact.data?.email_ids?.map((email) => {
|
||||||
@ -364,9 +364,10 @@ const sections = computed(() => {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
onDelete: (option, isNew) => {
|
onDelete: (option, isNew) => {
|
||||||
props.contact.data.email_ids = props.contact.data.email_ids.filter(
|
props.contact.data.email_ids =
|
||||||
(email) => email.name !== option.name
|
props.contact.data.email_ids.filter(
|
||||||
)
|
(email) => email.name !== option.name
|
||||||
|
)
|
||||||
!isNew && deleteOption('Contact Email', option.name)
|
!isNew && deleteOption('Contact Email', option.name)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -386,7 +387,7 @@ const sections = computed(() => {
|
|||||||
fields: [
|
fields: [
|
||||||
{
|
{
|
||||||
label: 'Mobile No.',
|
label: 'Mobile No.',
|
||||||
type: props.contact.data.name ? 'dropdown' : 'data',
|
type: props.contact?.data?.name ? 'dropdown' : 'data',
|
||||||
name: 'actual_mobile_no',
|
name: 'actual_mobile_no',
|
||||||
options:
|
options:
|
||||||
props.contact.data?.phone_nos?.map((phone) => {
|
props.contact.data?.phone_nos?.map((phone) => {
|
||||||
@ -408,9 +409,10 @@ const sections = computed(() => {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
onDelete: (option, isNew) => {
|
onDelete: (option, isNew) => {
|
||||||
props.contact.data.phone_nos = props.contact.data.phone_nos.filter(
|
props.contact.data.phone_nos =
|
||||||
(phone) => phone.name !== option.name
|
props.contact.data.phone_nos.filter(
|
||||||
)
|
(phone) => phone.name !== option.name
|
||||||
|
)
|
||||||
!isNew && deleteOption('Contact Phone', option.name)
|
!isNew && deleteOption('Contact Phone', option.name)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user