#51 feat: logo del sitio editable desde el panel de administración
This commit is contained in:
26
src/stores/settings.js
Normal file
26
src/stores/settings.js
Normal file
@@ -0,0 +1,26 @@
|
||||
import { defineStore } from 'pinia'
|
||||
|
||||
export const useSettingsStore = defineStore('settings', {
|
||||
state: () => ({
|
||||
settings: null,
|
||||
loaded: false
|
||||
}),
|
||||
getters: {
|
||||
logo: (state) => state.settings?.logo || null,
|
||||
address: (state) => state.settings?.address || '',
|
||||
latitude: (state) => state.settings?.latitude,
|
||||
longitude: (state) => state.settings?.longitude
|
||||
},
|
||||
actions: {
|
||||
async fetchSettings(api) {
|
||||
if (this.loaded) return this.settings
|
||||
this.settings = await api.getStoreSettings()
|
||||
this.loaded = true
|
||||
return this.settings
|
||||
},
|
||||
setSettings(settings) {
|
||||
this.settings = settings
|
||||
this.loaded = true
|
||||
}
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user