Skip to content

Need change in save method  #225

@monkeycatdog

Description

@monkeycatdog
JsonApiModel.prototype.save = function (params, headers, customUrl) {
  this.checkChanges();
  var attributesMetadata = this[AttributeMetadataIndex];
  return this.internalDatastore.saveRecord(attributesMetadata, this, params, headers, customUrl);
};

Good practice checkout arguments in function implementation, like a :

if (params instanceof HttpHeaders) {
  headers = params;
  params = {};
}

if (typeof headers === 'string'){
  customUrl = headers;
}

Without this check need set empty object for work headers, and if only need custom url, required add all arguments...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions