Skip to content

Instantly share code, notes, and snippets.

@DavertMik
Last active December 17, 2015 03:08
Show Gist options
  • Save DavertMik/5540641 to your computer and use it in GitHub Desktop.
Save DavertMik/5540641 to your computer and use it in GitHub Desktop.
kango user model
User = Backbone.Model.extend({
fetch: function() {
var xhr = {
url: 'http://mailican.com/api/user.json',
method: 'GET',
async: true,
contentType: 'json'
};
var self = this;
kango.xhr.send(xhr, function(data) {
if (data.status == 401) {
var signin = new SignInView();
signin.render();
} else {
self.set(data.response.user);
}
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment