Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
cancel error while save without change
  • Loading branch information
XadillaX committed Dec 10, 2015
1 parent b8513d8 commit 9d222d5
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions lib/yukari.js
Expand Up @@ -409,10 +409,22 @@ Yukari.prototype.update = function(callback) {
}
}

// FIX: if no data changed, then change all data
if(!.size(data)) {
callback(new Error("No data changed."));
promise._onExecuteResult(new Error("No data changed."));
return promise;
for(var key in this) {
if(!this.hasOwnProperty(key)) continue;
if(key[0] === "$") continue;
if(typeof this[key] === "function") continue;

var fieldIdx = this._fieldAt(key);
if(-1 === fieldIdx) continue;

var field = this.$fields[fieldIdx];
data[field.name] = {
data: this[key],
field: field
};
}
}

// set data
Expand Down

0 comments on commit 9d222d5

Please sign in to comment.