diff --git a/static/js/base.js b/static/js/base.js index f7085850..d06c2fbe 100644 --- a/static/js/base.js +++ b/static/js/base.js @@ -28,7 +28,15 @@ function addMsg(msg, alert_type) { + msg + "\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 896f996c..27173365 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); }); }