Permalink
Browse files

Fixed response

  • Loading branch information...
1 parent 77afbcc commit 4ea3fd251cf8ad38e9364bfb62726873eade5b1c @alekseykulikov committed Dec 14, 2012
Showing with 3 additions and 3 deletions.
  1. +2 −2 js/backbone_offline.js
  2. +1 −1 src/backbone_offline.coffee
@@ -5,7 +5,7 @@
global.Offline = {
VERSION: '0.4.1.alfa',
localSync: function(method, model, options, store) {
- var resp;
+ var resp, _ref;
resp = (function() {
switch (method) {
case 'read':
@@ -24,7 +24,7 @@
}
})();
if (resp) {
- return options.success();
+ return options.success((_ref = resp.attributes) != null ? _ref : resp);
} else {
return typeof options.error === "function" ? options.error('Record not found') : void 0;
}
@@ -18,7 +18,7 @@ do (global = window, _, Backbone) ->
when 'update' then store.update(model, options)
when 'delete' then store.destroy(model, options)
- if resp then options.success() else options.error?('Record not found')
+ if resp then options.success(resp.attributes ? resp) else options.error?('Record not found')
# Overrides default 'Backbone.sync'. It checks 'storage' property of the model or collection
# and then delegates to 'Offline.localSync' when property exists else calls the default 'Backbone.sync' with received params.

0 comments on commit 4ea3fd2

Please sign in to comment.