Skip to content

Commit

Permalink
Manage state for already scheduled meeting user
Browse files Browse the repository at this point in the history
  • Loading branch information
cp-dharti-r committed Jul 3, 2024
1 parent 1b7ae76 commit 8a62465
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
7 changes: 7 additions & 0 deletions nuxt-frontend/components/contact/CalendlyIframe.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
<script type="module">
import config from "@/config.js";
import loader from "@/assets/images/theme/loader.svg";
import { contactDetailStore } from "@/stores/contact";
const store = contactDetailStore();
export default {
data() {
Expand Down Expand Up @@ -68,9 +71,13 @@ export default {
) {
setTimeout(() => {
this.$emit("close");
this.setIsMeetingScheduled();
}, 2000);
}
},
async setIsMeetingScheduled() {
await useAsyncData("contact", () => store.setMeetingScheduled());
},
},
};
</script>
9 changes: 8 additions & 1 deletion nuxt-frontend/pages/thank-you.vue
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ import Header from "@/components/partials/NewHeader.vue";
import LandingSection from "@/components/contact/thank-you/LandingSection.vue";
import { elementInViewPort } from "@/utils.js";
import CalendlyIframe from "@/components/contact/CalendlyIframe.vue";
import { contactDetailStore } from "@/stores/contact";
const store = contactDetailStore();
const isMeetingScheduled = computed(() => store.isMeetingScheduled);
const BenefitSection = defineAsyncComponent(
() => import("@/components/contact/thank-you/BenefitSection.vue"),
Expand Down Expand Up @@ -100,7 +104,10 @@ onMounted(() => {
});
window.addEventListener("scroll", sendEvent);
$mixpanel.track("view_thankyou_page");
openCalendlyIframe();
if (!isMeetingScheduled.value) {
openCalendlyIframe();
}
});
onUnmounted(() => {
Expand Down
16 changes: 16 additions & 0 deletions nuxt-frontend/stores/contact/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { defineStore } from "pinia";

export const contactDetailStore = defineStore("contact-detail", {
state: () => {
return {
isMeetingScheduled: false,
};
},
actions: {
async setMeetingScheduled() {
return new Promise(() => {
this.isMeetingScheduled = true;
});
},
},
});

0 comments on commit 8a62465

Please sign in to comment.