Remove app, remove syncMixin; wrapSync now takes an auth parameter.
Showing
1 changed file
with
4 additions
and
8 deletions
... | @@ -32,12 +32,12 @@ define(function(require) { | ... | @@ -32,12 +32,12 @@ define(function(require) { |
32 | return deferred; | 32 | return deferred; |
33 | } | 33 | } |
34 | 34 | ||
35 | var authSync = function authSync(origSync, method, model, options) { | 35 | var authSync = function authSync(auth, origSync, method, model, options) { |
36 | var args = _.toArray(arguments); | 36 | var args = _.toArray(arguments); |
37 | args.shift(); | 37 | args.shift(); |
38 | var url = options.url || _.result(model, 'url'); | 38 | var url = options.url || _.result(model, 'url'); |
39 | if (url) { | 39 | if (url) { |
40 | var sessionId = app.get('auth').get('sessionId'); | 40 | var sessionId = auth.get('sessionId'); |
41 | if (sessionId) { | 41 | if (sessionId) { |
42 | options.url = url + (url.indexOf('?') == -1 ? '?' : '&') + 'sessionId=' + sessionId; | 42 | options.url = url + (url.indexOf('?') == -1 ? '?' : '&') + 'sessionId=' + sessionId; |
43 | } | 43 | } |
... | @@ -268,15 +268,11 @@ define(function(require) { | ... | @@ -268,15 +268,11 @@ define(function(require) { |
268 | }, { | 268 | }, { |
269 | FacebookProvider: FacebookProvider, | 269 | FacebookProvider: FacebookProvider, |
270 | FormProvider: FormProvider, | 270 | FormProvider: FormProvider, |
271 | wrapSync: function(origSync) { | 271 | wrapSync: function(auth, origSync) { |
272 | return function() { | 272 | return function() { |
273 | return authSync.apply(this, [origSync].concat(_.toArray(arguments))); | 273 | return authSync.apply(this, [auth, origSync].concat(_.toArray(arguments))); |
274 | }; | 274 | }; |
275 | }, | 275 | }, |
276 | syncMixin: function(Class) { | ||
277 | Class.prototype.sync = Auth.wrapSync(Class.prototype.sync); | ||
278 | return Class; | ||
279 | }, | ||
280 | }); | 276 | }); |
281 | return Auth; | 277 | return Auth; |
282 | }); | 278 | }); | ... | ... |
-
Please register or sign in to post a comment