diff --git a/crm/api/whatsapp.py b/crm/api/whatsapp.py index 96771162..2c4f6921 100644 --- a/crm/api/whatsapp.py +++ b/crm/api/whatsapp.py @@ -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( diff --git a/frontend/src/stores/settings.js b/frontend/src/stores/settings.js new file mode 100644 index 00000000..574c5223 --- /dev/null +++ b/frontend/src/stores/settings.js @@ -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 + }, +}) \ No newline at end of file