Skip to content

Datastore

Michael Dostál edited this page Nov 14, 2018 · 1 revision

Datastore config can be specified through the JsonApiDatastoreConfig decorator and/or by setting a config variable of the Datastore class. If an option is specified in both objects, a value from config variable will be taken into account.

@JsonApiDatastoreConfig(config: DatastoreConfig)
export class Datastore extends JsonApiDatastore {
    private customConfig: DatastoreConfig = {
        baseUrl: 'http://something.com'
    }

    constructor() {
        this.config = this.customConfig;
    }
}

config:

  • models - all the models which will be stored in the datastore
  • baseUrl - base API URL
  • apiVersion - optional, a string which will be appended to the baseUrl
  • overrides - used for overriding internal methods to achive custom functionalities
Overrides
  • getDirtyAttributes - determines which model attributes are dirty
  • toQueryString - transforms query parameters to a query string
Clone this wiki locally