Adding global error handler for ajax calls which run into redirections or unauthorized responses

This commit is contained in:
Thomas Müller 2015-06-06 22:43:41 +02:00 committed by Vincent Petry
parent 46b39c3465
commit 294dcb4eff
1 changed files with 7 additions and 0 deletions

View File

@ -1311,6 +1311,13 @@ function initCore() {
$('html').addClass('edge');
}
$( document ).ajaxError(function( event, request, settings ) {
if (_.contains([302, 307, 401], request.status)) {
var app = $('#content').attr('class').substring(4);
OC.redirect(OC.generateUrl('apps/' + app));
}
});
/**
* Calls the server periodically to ensure that session doesn't
* time out