Skip to content
This repository
Browse code

Fixed response

  • Loading branch information...
commit 4ea3fd251cf8ad38e9364bfb62726873eade5b1c 1 parent 77afbcc
Aleksey Kulikov authored December 14, 2012
4  js/backbone_offline.js
@@ -5,7 +5,7 @@
5 5
     global.Offline = {
6 6
       VERSION: '0.4.1.alfa',
7 7
       localSync: function(method, model, options, store) {
8  
-        var resp;
  8
+        var resp, _ref;
9 9
         resp = (function() {
10 10
           switch (method) {
11 11
             case 'read':
@@ -24,7 +24,7 @@
24 24
           }
25 25
         })();
26 26
         if (resp) {
27  
-          return options.success();
  27
+          return options.success((_ref = resp.attributes) != null ? _ref : resp);
28 28
         } else {
29 29
           return typeof options.error === "function" ? options.error('Record not found') : void 0;
30 30
         }
2  src/backbone_offline.coffee
@@ -18,7 +18,7 @@ do (global = window, _, Backbone) ->
18 18
         when 'update' then store.update(model, options)
19 19
         when 'delete' then store.destroy(model, options)
20 20
 
21  
-      if resp then options.success() else options.error?('Record not found')
  21
+      if resp then options.success(resp.attributes ? resp) else options.error?('Record not found')
22 22
 
23 23
     # Overrides default 'Backbone.sync'. It checks 'storage' property of the model or collection
24 24
     # and then delegates to 'Offline.localSync' when property exists else calls the default 'Backbone.sync' with received params.

0 notes on commit 4ea3fd2

Please sign in to comment.
Something went wrong with that request. Please try again.