diff --git a/src/ext/js/fileupload.js b/src/ext/js/fileupload.js index 1c069f2a8fdded69a2b7cc93f27601226e1d149c..395da76adf977e5b534d6923e107f4261494a4c2 100644 --- a/src/ext/js/fileupload.js +++ b/src/ext/js/fileupload.js @@ -114,8 +114,21 @@ var fileupload = new function() { return modal[0]; } - this.create_error_handler = function() { - return globalError; + this.create_error_handler = function(property) { + var input = $(property).find(".caosdb-f-property-value input"); + return function(event, error, xhr) { + if (xhr.status == "401") { + // add error message + input.after(`<div class="alert alert-danger alert-dismissible" + role="alert"> + <button type="button" class="close" data-dismiss="alert" + aria-label="Close"><span aria-hidden="true">×</span></button> + <strong>Error!</strong> You are not logged in!.</div>`); + } else { + globalError(event, error, xhr); + } + + } } /** Create a success handler function for the server's response which @@ -282,7 +295,7 @@ var fileupload = new function() { var default_path = this.get_default_path(); var button = this.create_small_icon_button(); var success_handler = this.create_success_handler(target); - var error_handler = this.create_error_handler(); + var error_handler = this.create_error_handler(target); var edit_menu = $(target).find(".caosdb-f-property-value")[0]; var dropzone_config = {