How to use pouchdb-ajax - 5 common examples

To help you get started, we’ve selected a few pouchdb-ajax examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pouchdb-community / pouchdb-authentication / src / users.js View on Github external
return new Promise(function (resolve, reject) {
      ajaxCore(opts, wrapError(function (err, res) {
        if (err) {
          return reject(err);
        }
        resolve(res);
      }));
    });
  };
github pouchdb-community / pouchdb-authentication / src / admins.js View on Github external
var getMembership = toPromise(function (opts, callback) {
  var db = this;
  if (typeof callback === 'undefined') {
    callback = opts;
    opts = {};
  }

  var url = getBaseUrl(db) + '/_membership';
  var ajaxOpts = assign({
    method: 'GET',
    url: url,
    headers: getBasicAuthHeaders(db),
  }, opts.ajax || {});
  ajaxCore(ajaxOpts, wrapError(callback));
});
github pouchdb-community / pouchdb-authentication / src / users.js View on Github external
}
    user = assign(user, opts.metadata);
  }

  if (opts.roles) {
    user = assign(user, {roles: opts.roles});
  }

  var url = getUsersUrl(db) + '/' + encodeURIComponent(user._id);
  var ajaxOpts = assign({
    method: 'PUT',
    url: url,
    body: user,
    headers: getBasicAuthHeaders(db),
  }, opts.ajax || {});
  ajaxCore(ajaxOpts, wrapError(callback));
}
github pouchdb-community / pouchdb-authentication / src / authentication.js View on Github external
var logOut = toPromise(function (opts, callback) {
  var db = this;
  if (typeof callback === 'undefined') {
    callback = opts;
    opts = {};
  }
  var ajaxOpts = assign({
    method: 'DELETE',
    url: getSessionUrl(db),
    headers: getBasicAuthHeaders(db),
  }, opts.ajax || {});
  ajaxCore(ajaxOpts, wrapError(callback));
});
github pouchdb-community / pouchdb-authentication / src / users.js View on Github external
db.getUser(username, opts, function (error, user) {
    if (error) {
      return callback(error);
    }

    var url = getUsersUrl(db) + '/' + encodeURIComponent(user._id) + '?rev=' + user._rev;
    var ajaxOpts = assign({
      method: 'DELETE',
      url: url,
      headers: getBasicAuthHeaders(db),
    }, opts.ajax || {});
    ajaxCore(ajaxOpts, wrapError(callback));
  });
});

pouchdb-ajax

PouchDB's ajax() method.

Apache-2.0
Latest version published 7 years ago

Package Health Score

69 / 100
Full package analysis

Popular pouchdb-ajax functions