fix: created a settings store

This commit is contained in:
Shariq Ansari 2024-12-27 21:47:07 +05:30
parent 917f999a7a
commit 73f227f76b

View File

@ -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,
}
}