summaryrefslogtreecommitdiff
path: root/app/node_modules/okresource/index.js
diff options
context:
space:
mode:
Diffstat (limited to 'app/node_modules/okresource/index.js')
-rw-r--r--app/node_modules/okresource/index.js12
1 files changed, 7 insertions, 5 deletions
diff --git a/app/node_modules/okresource/index.js b/app/node_modules/okresource/index.js
index febd1d5..0e8498f 100644
--- a/app/node_modules/okresource/index.js
+++ b/app/node_modules/okresource/index.js
@@ -91,14 +91,16 @@ OKResource.prototype.create = function(data) {
});
};
-OKResource.prototype.destroy = function(data) {
- data = data || {};
- var id = data[this.idField];
+OKResource.prototype.destroy = function(id) {
+ var db = this._db;
+ var type = this.type;
+ var query = {};
+ query[this.idField] = id;
return Q.promise(function(resolve, reject) {
if (!id) {
- reject(new Error('Data does not contain ID property'));
+ reject(new Error('No ID given'));
} else {
- this._db.remove(this.type, data.id, data).then(resolve).fail(reject);
+ db.remove(type, query).then(resolve).fail(reject);
}
});
};