Skip to content

Commit 0bbef64

Browse files
committed
Adding global error handler for ajax calls which run into redirections or unauthorized responses
1 parent 16708ae commit 0bbef64

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

core/js/js.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1084,6 +1084,12 @@ function initCore() {
10841084
*/
10851085
moment.locale(OC.getLocale());
10861086

1087+
$( document ).ajaxError(function( event, request, settings ) {
1088+
if (_.contains([302, 307, 401], request.status)) {
1089+
var app = $('#content').attr('class').substring(4);
1090+
OC.redirect(OC.generateUrl('apps/' + app));
1091+
}
1092+
});
10871093

10881094
/**
10891095
* Calls the server periodically to ensure that session doesn't

0 commit comments

Comments
 (0)