X Enterprises
Composables

useXAdminSystemSettings

Reads and updates grouped system settings with single or bulk writes and a groupedSettings computed view.

useXAdminSystemSettings

System settings composable. Wraps GET/PUT /api/admin/settings for grouped key-value settings. Setting shape: { group, key, value, type, label?, description? }, where type is 'string' | 'number' | 'boolean' and drives the input control in the UI. Pairs with XAdminSettings for the grouped inline-edit view.

Uses the useXCrud v2 factory API from @xenterprises/nuxt-x-app — the returned settings is a v2 list instance (useXCrud("admin/settings").all()). Filter by assigning settings.filters.value and reload with await settings.refresh(); there is no .fetch(params).

Usage

const systemSettings = useXAdminSystemSettings()

systemSettings.settings.data.value
systemSettings.groupedSettings.value // { general: [...], billing: [...], ... }
systemSettings.getSetting("general", "siteName")

await systemSettings.updateSetting({ group: "general", key: "siteName", value: "Acme" })
await systemSettings.updateSettings([{ group: "general", key: "siteName", value: "Acme" }])

Options

OptionTypeDefaultDescription
baseEndpointstring'admin/settings'API endpoint base the composable calls.
showToastbooleantrueShow toast notifications on success/failure.

Returns

KeyTypeDescription
settingsuseXCrud v2 list instanceReactive settings list: { data, total, filters, search, sort, loading, error, refresh, ... }.
groupedSettingsComputedRef<Record<string, object[]>>Settings grouped by group ('general' when unset).
getSetting(group: string, key: string) => object | nullFinds a single setting by group and key.
updateSetting({ group, key, value }) => Promise<void>Updates one setting (PUT /api/admin/settings) and refreshes.
updateSettings(entries: object[]) => Promise<void>Bulk update (PUT with { settings: entries }) and refreshes.

AI Context

composable: useXAdminSystemSettings
package: "@xenterprises/nuxt-x-app-admin"
use-when: >
  Reading or updating grouped system settings — string/number/boolean
  key-value pairs — with single or bulk writes. Uses GET/PUT
  /api/admin/settings and the useXCrud v2 factory API
  (filters-assignment + refresh(), no .fetch(params)).
pairs-with: XAdminSettings
Copyright © 2026