From c843f68738d04bd2bd0d95fda1bd9d9b939a169d Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Thu, 16 Nov 2023 17:25:39 +0530 Subject: [PATCH] fix: not able to redirect after creating org from lead/deal --- frontend/src/pages/Deal.vue | 10 +++++++--- frontend/src/pages/Lead.vue | 17 ++++++++++------- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/frontend/src/pages/Deal.vue b/frontend/src/pages/Deal.vue index 5d4089b5..a3615f28 100644 --- a/frontend/src/pages/Deal.vue +++ b/frontend/src/pages/Deal.vue @@ -357,7 +357,10 @@ :organization="_organization" :options="{ redirect: false, - afterInsert: (doc) => updateField('organization', doc.name), + afterInsert: (doc) => + updateField('organization', doc.name, () => { + organizations.reload() + }), }" /> { return getOrganization(deal.data.organization) }) -function updateField(name, value) { +function updateField(name, value, callback) { updateDeal(name, value, () => { deal.data[name] = value + callback?.() }) } diff --git a/frontend/src/pages/Lead.vue b/frontend/src/pages/Lead.vue index eb02c9ea..b77f2665 100644 --- a/frontend/src/pages/Lead.vue +++ b/frontend/src/pages/Lead.vue @@ -299,7 +299,10 @@ :organization="_organization" :options="{ redirect: false, - afterInsert: (doc) => updateField('organization', doc.name), + afterInsert: (doc) => + updateField('organization', doc.name, () => { + organizations.reload() + }), }" /> @@ -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?.() }) }