Permalink
Browse files

cancel error while save without change

  • Loading branch information...
XadillaX committed Dec 10, 2015
1 parent b8513d8 commit 9d222d53677970375feb13e861cfc80bee265998
Showing with 15 additions and 3 deletions.
  1. +15 −3 lib/yukari.js
@@ -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

0 comments on commit 9d222d5

Please sign in to comment.