Skip to content

Commit

Permalink
Adding global error handler for ajax calls which run into redirection…
Browse files Browse the repository at this point in the history
…s or unauthorized responses
  • Loading branch information
DeepDiver1975 committed Jun 6, 2015
1 parent 16708ae commit 0bbef64
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions core/js/js.js
Original file line number Diff line number Diff line change
Expand Up @@ -1084,6 +1084,12 @@ function initCore() {
*/
moment.locale(OC.getLocale());

$( 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
Expand Down

0 comments on commit 0bbef64

Please sign in to comment.