Permalink
Browse files
cancel error while save without change
- Loading branch information...
Showing
with
15 additions
and
3 deletions.
-
+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