fix: created a settings store
This commit is contained in:
parent
917f999a7a
commit
73f227f76b
28
frontend/src/stores/settings.js
Normal file
28
frontend/src/stores/settings.js
Normal 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,
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user