PDA

View Full Version : Ext.data.Connection.prototype.handleResponse not working after upgrading to ext 3



edfilo
2 Feb 2010, 2:49 PM
I used this code in ext 2.1 to sniff all of my applications server responses for a status of 'loggedout' , it stopped working after upgrading to ext 3 - the function doesnt get called. is there a better way to have every server response look for logout status?



Ext.data.Connection.prototype.handleResponse = function(response, e) {

var intercept=Ext.decode(response.responseText);

if(intercept.status){
if(intercept.status=='loggedout'){

window.location='/';
}
return;
}

Ext.data.Connection.prototype._handleResponse.call(this, response, e);
};

edfilo
2 Feb 2010, 4:04 PM
Maybe this is a better solution? found this in another thread and it seems to work fine.




Ext.Ajax.on( 'requestcomplete', function( connection , response , options ) {
var intercept=Ext.decode(response.responseText);

if(intercept.status){
if(intercept.status=='loggedout'){

window.location='/';
}
return;
}
} , this );