ACP: general settings, branding, and favicon uploads

This commit is contained in:
2026-01-02 20:01:22 +01:00
parent 8604cdf95d
commit fe1015bff1
23 changed files with 1025 additions and 25 deletions

View File

@@ -75,8 +75,40 @@ export async function fetchVersion() {
}
export async function fetchSetting(key) {
const data = await getCollection(`/settings?key=${encodeURIComponent(key)}&pagination=false`)
return data[0] || null
const cacheBust = Date.now()
const data = await apiFetch(
`/settings?key=${encodeURIComponent(key)}&pagination=false&_=${cacheBust}`,
{ cache: 'no-store' }
)
if (Array.isArray(data)) {
return data[0] || null
}
return data?.['hydra:member']?.[0] || null
}
export async function saveSetting(key, value) {
return apiFetch('/settings', {
method: 'POST',
body: JSON.stringify({ key, value }),
})
}
export async function uploadLogo(file) {
const body = new FormData()
body.append('file', file)
return apiFetch('/uploads/logo', {
method: 'POST',
body,
})
}
export async function uploadFavicon(file) {
const body = new FormData()
body.append('file', file)
return apiFetch('/uploads/favicon', {
method: 'POST',
body,
})
}
export async function fetchUserSetting(key) {