diff --git a/static/js/base.js b/static/js/base.js index f70858500cf97aa61d45fe019429999df51c9c35..d06c2fbe1d4c57a218e98f9da61fa6831f8b56a8 100644 --- a/static/js/base.js +++ b/static/js/base.js @@ -28,7 +28,15 @@ function addMsg(msg, alert_type) { + msg + "</div>\n"; msgDiv.html(html); } - +/** + * add Muliple error message from err_obj + * @param err_obj {error_code:erro_message} + */ +function errMsg(errs_obj){ + for (const err_msg of Object.values(errs_obj)) { + addMsg(err_msg,'danger'); + } +} /** * Reload the balance of the user on the right top corner */ diff --git a/static/js/consos.js b/static/js/consos.js index 896f996ccccf6117ffa828d37c58c8aa6471c9aa..271733659e99b7424b59c7431651150f59adba7b 100644 --- a/static/js/consos.js +++ b/static/js/consos.js @@ -200,7 +200,6 @@ function consume(source, dest, quantity, amount, reason, type, category, templat "template": template }, reset).fail(function (e) { reset(); - - addMsg("Une erreur est survenue lors de la transaction : " + e.responseText, "danger"); + errMsg(e.responseJSON); }); }