ember.js - Ember-Data handling 401’s -


any thoughts on handling 401 errors?

in application initializer i'm deferring readiness , fetching current user via ember-data. if receive 401 app dies , becomes unusable. i'd handle error, , advancereadiness. cant seem find workaround this. info appreciated!

gist here: https://gist.github.com/unknpwn/6126462

i noticed there similar topic here, seems out of date.

application.initializer not correct place put logic. synchronous , it's purpose things adding custom objects ioc container, etc. code better suited in model hooks of applicationroute.

app.applicationroute = ember.route.extend({   beforemodel: function() {     return app.user.find({ filter: "authenticated" });   },   setupcontroller: function(controller, model) {     controller.set('loggedin', true);     controller.set('currentuser', model);// or property of model   },   events: function() {     error: function(err) {       // error handler called in case of error.       // show error message user here       // or transition route     }   } }); 

Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

VBA function to include CDATA -