Sha256: b52e6206e44d4ce21f9ef800d90a4ae6619a53176652075fde44db256f7d70b2

Contents?: true

Size: 701 Bytes

Versions: 2

Compression:

Stored size: 701 Bytes

Contents

if (typeof $ === "undefined") { throw new Error("jQuery is required") }

var RecordModel = function(kind, id){
  var Record = function() {
    this.object = null;
  }
  
  Record.prototype.fetch = function(callback, errback) {
    errback || (errback = function(status, text, xhr){
      alert("Error fetching " + kind + ":" + id + " " + status + " " + text);
    });
    var self = this;
    $.ajax({
      url: "/api/" + kind + "/" + encodeURIComponent(id),
      success: function(data) {
        self.object = data;
        callback(self);
      },
      error: function(xhr, textStatus, errorThrown){
        errback(xhr.status, errorThrown, xhr);
      }
    });
  }
  
  return new Record();
}

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
conjur-asset-ui-api-1.1.1 public/js/models/record.js
conjur-asset-ui-api-1.1.0 public/js/models/record.js