bd9aa01a by Adam Heath

Remove app, remove syncMixin; wrapSync now takes an auth parameter.

1 parent fb7b1114
......@@ -32,12 +32,12 @@ define(function(require) {
return deferred;
}
var authSync = function authSync(origSync, method, model, options) {
var authSync = function authSync(auth, origSync, method, model, options) {
var args = _.toArray(arguments);
args.shift();
var url = options.url || _.result(model, 'url');
if (url) {
var sessionId = app.get('auth').get('sessionId');
var sessionId = auth.get('sessionId');
if (sessionId) {
options.url = url + (url.indexOf('?') == -1 ? '?' : '&') + 'sessionId=' + sessionId;
}
......@@ -268,15 +268,11 @@ define(function(require) {
}, {
FacebookProvider: FacebookProvider,
FormProvider: FormProvider,
wrapSync: function(origSync) {
wrapSync: function(auth, origSync) {
return function() {
return authSync.apply(this, [origSync].concat(_.toArray(arguments)));
return authSync.apply(this, [auth, origSync].concat(_.toArray(arguments)));
};
},
syncMixin: function(Class) {
Class.prototype.sync = Auth.wrapSync(Class.prototype.sync);
return Class;
},
});
return Auth;
});
......