fix: added settings store to check is whatsapp enabled

This commit is contained in:
Shariq Ansari 2024-04-24 15:51:51 +05:30
parent 6ca6c009f2
commit 470b14fccb
2 changed files with 17 additions and 0 deletions

View File

@ -48,6 +48,10 @@ def parse_mobile_no(mobile_no: str):
"""
return ''.join([c for c in mobile_no if c.isdigit() or c == '+'])
@frappe.whitelist()
def is_whatsapp_enabled():
return frappe.get_cached_value('WhatsApp Settings', 'WhatsApp Settings', 'enabled')
@frappe.whitelist()
def get_whatsapp_messages(reference_doctype, reference_name):
messages = frappe.get_all(

View File

@ -0,0 +1,13 @@
import { createResource } from 'frappe-ui'
import { ref } from 'vue'
export const whatsappEnabled = ref(false)
createResource({
url: 'crm.api.whatsapp.is_whatsapp_enabled',
cache: 'Is Whatsapp Enabled',
auto: true,
onSuccess: (data) => {
whatsappEnabled.value = data
},
})