Skip to Content

queryRecord()

Fetches a single record from the server without an ID (GET /{resource}).

Unlike findRecord, no ID is appended to the URL - the server is expected to return a single object (e.g. the current user’s profile, a singleton resource).

Kind: global function
Returns: Object | Promise - Reactive request hash (default) or Axios Promise when autoResolve: false.
Throws:

  • Error If resource is not a registered collection.
ParamTypeDefaultDescription
resourcestringThe resource name / collection name.
[params]ObjectQuery parameters appended to the request URL.
[config]RequestConfigRequest configuration options.

Example

// Reactive const result = ARM.queryRecord('addresses', { 'filter[id]': 123 }, { alias: 'currentAddress' }) result.isLoading // true while fetching result.data // CollectionRecord once resolved

Example

// Awaitable await ARM.queryRecord('profile', {}, { autoResolve: false })
Last updated on