Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
updateQuery: async (_, { subscriptionData }) => {
const { callID, type, fromUser, chat, message } = subscriptionData.data.webRTCMessage
const Busy = await RNCallKit.checkIfBusy()
if (Busy) {
await refuseCall(callID, chat._id, CALL_TYPES.BUSY)
}
if (type === 'offer') {
RNCallKit.displayIncomingCall(callID, fromUser, '', 'generic', true)
RNCallKit.addEventListener('endCall', () =>
refuseCall(callID, chat._id, CALL_TYPES.REJECT),
)
RNCallKit.addEventListener('answerCall', () =>
answerCall(callID, chat._id, fromUser, message),
)
}
},
})