added PSR-12 rules
This commit is contained in:
@@ -75,6 +75,7 @@ export async function fetchVersion() {
|
||||
}
|
||||
|
||||
export async function fetchSetting(key) {
|
||||
// TODO: Prefer fetchSettings() when multiple settings are needed.
|
||||
const cacheBust = Date.now()
|
||||
const data = await apiFetch(
|
||||
`/settings?key=${encodeURIComponent(key)}&pagination=false&_=${cacheBust}`,
|
||||
@@ -86,6 +87,15 @@ export async function fetchSetting(key) {
|
||||
return data?.['hydra:member']?.[0] || null
|
||||
}
|
||||
|
||||
export async function fetchSettings() {
|
||||
const cacheBust = Date.now()
|
||||
const data = await apiFetch(`/settings?pagination=false&_=${cacheBust}`, { cache: 'no-store' })
|
||||
if (Array.isArray(data)) {
|
||||
return data
|
||||
}
|
||||
return data?.['hydra:member'] || []
|
||||
}
|
||||
|
||||
export async function saveSetting(key, value) {
|
||||
return apiFetch('/settings', {
|
||||
method: 'POST',
|
||||
@@ -93,6 +103,13 @@ export async function saveSetting(key, value) {
|
||||
})
|
||||
}
|
||||
|
||||
export async function saveSettings(settings) {
|
||||
return apiFetch('/settings/bulk', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({ settings }),
|
||||
})
|
||||
}
|
||||
|
||||
export async function uploadLogo(file) {
|
||||
const body = new FormData()
|
||||
body.append('file', file)
|
||||
|
||||
Reference in New Issue
Block a user