From 294dcb4efffabc30fb85f50f2e01af2904b476a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Sat, 6 Jun 2015 22:43:41 +0200 Subject: [PATCH] Adding global error handler for ajax calls which run into redirections or unauthorized responses --- core/js/js.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/core/js/js.js b/core/js/js.js index 83658a537b..b646ff5c6f 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