mirror of
https://github.com/abhinavxd/libredesk.git
synced 2025-11-02 04:53:41 +00:00
36 lines
1008 B
JavaScript
36 lines
1008 B
JavaScript
import { defineStore } from 'pinia'
|
|
import api from '@/api'
|
|
|
|
export const useAppSettingsStore = defineStore('settings', {
|
|
state: () => ({
|
|
settings: {},
|
|
public_config: {}
|
|
}),
|
|
actions: {
|
|
async fetchSettings (key = 'general') {
|
|
try {
|
|
const response = await api.getSettings(key)
|
|
this.settings = response?.data?.data || {}
|
|
return this.settings
|
|
} catch (error) {
|
|
// Pass
|
|
}
|
|
},
|
|
async fetchPublicConfig () {
|
|
try {
|
|
const response = await api.getConfig()
|
|
this.public_config = response?.data?.data || {}
|
|
return this.public_config
|
|
} catch (error) {
|
|
// Pass
|
|
}
|
|
},
|
|
setSettings (newSettings) {
|
|
this.settings = newSettings
|
|
},
|
|
setPublicConfig (newPublicConfig) {
|
|
this.public_config = newPublicConfig
|
|
}
|
|
}
|
|
})
|