diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2015-06-06 22:43:41 +0200 |
---|---|---|
committer | Vincent Petry <pvince81@owncloud.com> | 2016-02-15 12:47:18 +0100 |
commit | 294dcb4efffabc30fb85f50f2e01af2904b476a6 (patch) | |
tree | fa515ff8471f48b72de09cff09b779ff5161903e /core | |
parent | 46b39c3465e2db9ba26b23d8d0dfca6cc670aaea (diff) | |
download | nextcloud-server-294dcb4efffabc30fb85f50f2e01af2904b476a6.tar.gz nextcloud-server-294dcb4efffabc30fb85f50f2e01af2904b476a6.zip |
Adding global error handler for ajax calls which run into redirections or unauthorized responses
Diffstat (limited to 'core')
-rw-r--r-- | core/js/js.js | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/core/js/js.js b/core/js/js.js index 83658a537b8..b646ff5c6f9 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -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 |