I have a situation where I am making ajax requests to a server from various Ext gridpanel etc. In an Admin area. 
The logged in user will be logged out if there is no activity for eg. 5 minutes which is normal.
In this case the server sends back a redirect 403 to the login page.
Right now I am inserting a:
listeners: {     exception: function(proxy, response, operation, eOpts) {         if (response.status == '403')             window.location = 'login';     } }   To every store's proxy which is a little overkill. 
Could someone be kind enough and let me know how I could add a listener to all communications between ExtJS and server?
I am using the MVC Application Architecture so it could probably be a one liner in the controller.js or app.js. 
Thanks
In the beginning of your app insert the following snippet. With this EVERY response, whether it's from a store or a form or ..., will be checked and redirect to login page.
Ext.Ajax.on('requestexception', function (conn, response, options) {     if (response.status === 403) {         window.location = 'login';     } }); 
                        I'm not really sure if this will catch all ajax requests but assuming you're using AjaxProxy for all communication with the server it should work: handle the 'requestexception' event in the Ext.Ajax singleton something like this
Ext.Ajax.on('requestexception', function(conn, response, options, eOpts) {     //your error handling here });   I haven't tried it but if you do, could you post an update here?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With