diff --git a/frontend/src/stores/settings.js b/frontend/src/stores/settings.js new file mode 100644 index 00000000..55675ae2 --- /dev/null +++ b/frontend/src/stores/settings.js @@ -0,0 +1,28 @@ +import { createDocumentResource } from 'frappe-ui' +import { reactive, ref } from 'vue' + +const settings = ref({}) +const brand = reactive({}) + +export function getSettings() { + const _settings = createDocumentResource({ + doctype: 'FCRM Settings', + name: 'FCRM Settings', + onSuccess: (data) => { + settings.value = data + brand.name = settings.value?.brand_name + brand.logo = settings.value?.brand_logo + brand.favicon = settings.value?.favicon + return data + }, + }) + + if (!settings.value?.length) { + _settings.fetch() + } + + return { + settings, + brand, + } +}