22 lines
550 B
JavaScript
22 lines
550 B
JavaScript
|
|
import { defineStore } from 'pinia'
|
||
|
|
|
||
|
|
export const useAppStore = defineStore('app', {
|
||
|
|
state: () => ({
|
||
|
|
queryRetentionDays: 0,
|
||
|
|
isLoaded: false,
|
||
|
|
}),
|
||
|
|
actions: {
|
||
|
|
async fetchAppConfig() {
|
||
|
|
try {
|
||
|
|
const { data, error } = await useApiFetch('/app/config').get().json()
|
||
|
|
if (data.value && !error.value && data.value.code === 200) {
|
||
|
|
const cfg = data.value.data
|
||
|
|
this.queryRetentionDays = Number(cfg.query_retention_days) || 0
|
||
|
|
}
|
||
|
|
} catch (e) {
|
||
|
|
}
|
||
|
|
this.isLoaded = true
|
||
|
|
},
|
||
|
|
},
|
||
|
|
})
|