X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=app%2FResources%2Fstatic%2Fthemes%2F_global%2Findex.js;fp=app%2FResources%2Fstatic%2Fthemes%2F_global%2Findex.js;h=3ec26488272b5da2fe2aa61a0d0203b66fd1ca3f;hb=2c3e148b0029a094431622feac79fafcd0d43fc8;hp=3fdcaa3d078b0525e1df27f5a0c55b534621b968;hpb=a687c8d915276eee0c0494156700f7d0c0606735;p=github%2Fwallabag%2Fwallabag.git diff --git a/app/Resources/static/themes/_global/index.js b/app/Resources/static/themes/_global/index.js index 3fdcaa3d..3ec26488 100644 --- a/app/Resources/static/themes/_global/index.js +++ b/app/Resources/static/themes/_global/index.js @@ -34,7 +34,21 @@ $(document).ready(() => { app.registry.registerUtility(authorization, 'authorizationPolicy'); const x = JSON.parse($('#annotationroutes').html()); - app.include(annotator.storage.http, x); + app.include(annotator.storage.http, $.extend({}, x, { + onError(msg, xhr) { + if (!Object.prototype.hasOwnProperty.call(xhr, 'responseJSON')) { + annotator.notification.banner('An error occurred', 'error'); + return; + } + $.each(xhr.responseJSON.children, (k, v) => { + if (v.errors) { + $.each(v.errors, (n, errorText) => { + annotator.notification.banner(errorText, 'error'); + }); + } + }); + }, + })); app.start().then(() => { app.annotations.load({ entry: x.entryId });