Files
ycc-proxy-webview/src/stores/appStore.js
2025-12-16 19:27:20 +08:00

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