-
Notifications
You must be signed in to change notification settings - Fork 86
/
brightics-va-ajax.min.js
2 lines (2 loc) · 1.39 KB
/
brightics-va-ajax.min.js
1
2
/* Brightics VA Build 200427 */
$.ajaxSetup({beforeSend:function(e,s){if(s&&s.blocking){var r={open:function(e,s){this.$el=$('<div class="brtc-dim"><div class="brtc-dim-text brtc-style-appear-1sendond"><i class="fa fa-spinner fa-pulse fa-5x fa-fw"></i></div></div>'),$("body").append(this.$el)},close:function(e,s,r){this.$el.remove()}};r.open(),e.done(r.close.bind(r)),e.fail(r.close.bind(r))}},error:function(e,s,r){var o={errors:[{message:"Sorry! An unexpected error occurred. Please contact administrator.",code:400,contentType:e.getResponseHeader("Content-Type")}]};401==e.status?($(window).unbind("beforeunload"),o={errors:[{message:"The session has expired and the last operation was not applied. Please login again to continue.",code:401}]},Brightics.VA.Core.Utils.WidgetUtils.openErrorDialog(o,function(){window.location.href="/"})):403===e.status?(o.errors[0].code=403,e.responseJSON&&e.responseJSON.errors?(o=e.responseJSON).errors[0].contentType=e.getResponseHeader("Content-Type"):(o.errors[0].message="Maximum file length exceeded.",o.errors[0].detailMessage=e.responseText),Brightics.VA.Core.Utils.WidgetUtils.openErrorDialog(o)):400!==e.status&&(o.errors[0].code=e.status,e.responseJSON&&e.responseJSON.errors?(o=e.responseJSON).errors[0].contentType=e.getResponseHeader("Content-Type"):e.responseText&&(o.errors[0].detailMessage=e.responseText),Brightics.VA.Core.Utils.WidgetUtils.openErrorDialog(o))}});