user.save({}, {
success: function(response) {
if (response.token) {
localStorage.setItem('access_token', response.token);
window.workspace.navigate('#', { trigger: true});
}},
error: function(response) {
var error = JSON.parse(response.responseText)
}
Backbone._sync = Backbone.sync
Backbone._sync = function(method, model, options) {
options = $.extend({
crossDomain: true
, xhrFields: {
withCredentials: true
}
, beforeSend: function(xhr){
xhr.setRequestHeader('Authorization', 'Token ' + localStorage.getItem('access_token'));
}
}, options);
return Backbone._sync(method, model, options);
}
я к примеру junior) но активно использую backbone, require и phonegap. Можно ли меня назвать junior ?