From 6dfc2be68eba014643a9d71c78a85434586c8e2a Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Wed, 20 Sep 2023 14:10:29 +0530 Subject: [PATCH 1/2] fix: created global makeCall method instead of using provide/inject --- frontend/src/components/CallUI.vue | 14 +++----------- frontend/src/pages/Deal.vue | 2 -- frontend/src/pages/Lead.vue | 2 -- 3 files changed, 3 insertions(+), 15 deletions(-) diff --git a/frontend/src/components/CallUI.vue b/frontend/src/components/CallUI.vue index 7f27e4d9..e30af3b7 100644 --- a/frontend/src/components/CallUI.vue +++ b/frontend/src/components/CallUI.vue @@ -187,7 +187,7 @@ import { Device } from '@twilio/voice-sdk' import { useDraggable, useWindowSize } from '@vueuse/core' import { contactsStore } from '@/stores/contacts' import { Avatar, call } from 'frappe-ui' -import { onMounted, provide, ref, watch } from 'vue' +import { onMounted, ref, watch, getCurrentInstance } from 'vue' import NoteModal from './NoteModal.vue' const { getContact } = contactsStore() @@ -292,15 +292,6 @@ function addDeviceListeners() { }) } -// function update_call_log(conn, status = 'Completed') { -// console.log('connection', conn) -// if (!conn.parameters.CallSid) return -// call('crm.twilio.api.update_call_log', { -// call_sid: conn.parameters.CallSid, -// status: status, -// }) -// } - function toggleMute() { if (_call.value.isMuted()) { _call.value.mute(false) @@ -492,7 +483,8 @@ watch( { immediate: true } ) -provide('makeOutgoingCall', makeOutgoingCall) +const app = getCurrentInstance() +app.appContext.config.globalProperties.makeCall = makeOutgoingCall