fix: not able to redirect after creating org from lead/deal

This commit is contained in:
Shariq Ansari 2023-11-16 17:25:39 +05:30
parent e9bbd2fba7
commit c843f68738
2 changed files with 17 additions and 10 deletions

View File

@ -357,7 +357,10 @@
:organization="_organization"
:options="{
redirect: false,
afterInsert: (doc) => updateField('organization', doc.name),
afterInsert: (doc) =>
updateField('organization', doc.name, () => {
organizations.reload()
}),
}"
/>
<ContactModal
@ -413,7 +416,7 @@ import { useRouter } from 'vue-router'
const { getUser } = usersStore()
const { getContactByName, contacts } = contactsStore()
const { getOrganization, getOrganizationOptions } = organizationsStore()
const { organizations, getOrganization } = organizationsStore()
const router = useRouter()
const props = defineProps({
@ -648,9 +651,10 @@ const organization = computed(() => {
return getOrganization(deal.data.organization)
})
function updateField(name, value) {
function updateField(name, value, callback) {
updateDeal(name, value, () => {
deal.data[name] = value
callback?.()
})
}
</script>

View File

@ -299,7 +299,10 @@
:organization="_organization"
:options="{
redirect: false,
afterInsert: (doc) => updateField('organization', doc.name),
afterInsert: (doc) =>
updateField('organization', doc.name, () => {
organizations.reload()
}),
}"
/>
</template>
@ -347,7 +350,7 @@ import { useRouter } from 'vue-router'
const { getUser } = usersStore()
const { contacts } = contactsStore()
const { getOrganization } = organizationsStore()
const { organizations, getOrganization } = organizationsStore()
const router = useRouter()
const props = defineProps({
@ -459,12 +462,11 @@ const detailSections = computed(() => {
showOrganizationModal.value = true
close()
},
link: () => {
link: () =>
router.push({
name: 'Organization',
params: { organizationId: organization.value?.name },
})
},
params: { organizationId: lead.data.organization },
}),
},
{
label: 'Website',
@ -548,9 +550,10 @@ async function convertToDeal() {
}
}
function updateField(name, value) {
function updateField(name, value, callback) {
updateLead(name, value, () => {
lead.data[name] = value
callback?.()
})
}
</script>