up
This commit is contained in:
24
frontend/src/stores/settings.ts
Normal file
24
frontend/src/stores/settings.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import { defineStore } from 'pinia'
|
||||
import { ref } from 'vue'
|
||||
|
||||
export const useSettingsStore = defineStore('settings', () => {
|
||||
const siteName = ref('Admin Panel')
|
||||
const siteDescription = ref('')
|
||||
const enableRegistration = ref(true)
|
||||
|
||||
async function loadSettings() {
|
||||
try {
|
||||
const res = await fetch('/api/settings')
|
||||
if (res.ok) {
|
||||
const data = await res.json()
|
||||
siteName.value = data.site_name || 'Admin Panel'
|
||||
siteDescription.value = data.site_description || ''
|
||||
enableRegistration.value = data.enable_registration !== 'false'
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('Failed to load settings', e)
|
||||
}
|
||||
}
|
||||
|
||||
return { siteName, siteDescription, enableRegistration, loadSettings }
|
||||
})
|
||||
Reference in New Issue
Block a user