I have a web-application in ExtJs. I need to do logout, when response status of Ajax request is 401. I use this code:
Ext.Ajax.on('requestexception', function(connection, response, options){
if (response){
if (response.status == 401 && myApp.auth.userInfo != null){
myApp.auth.logout();
}
}
});
It works, but when I have a few requests myApp.auth.logout(); calls several times and I can't to login again, after reloading page I can login. Is there any filters for requests or some method to make Ext.Ajax.on('requestexception') synchronous, that function myApp.auth.logout(); calls only one time?