Commit 35054e45 authored by Mikaël Salson's avatar Mikaël Salson Committed by Vidjil Team
Browse files

database.js: priority of a notification can be given

The type of message is determined with two variables:
* success either 'true' or 'false' determining if we had an error
* priority by default 1 if success == 'true' and 2 otherwise, can be overridden
  to be 3 (critical error: the user must see the message) or 0 (hidden message).

This is useful for the upload where we want the error message to be seen by the user.
parent ffe6a2f6
......@@ -226,9 +226,13 @@ Database.prototype = {
}
//the json result contain a flash message
if (res.message) console.log({"type": "flash",
"msg": "database : " + res.message,
"priority": res.success == "false" ? 2 : 1}) // res.success can be 'undefined'
if (res.message) {
priority = res.success == 'false' ? 2 : 1
priority = res.priority == 'undefined' ? priority : res.priority
console.log({"type": "flash",
"msg": "database : " + res.message,
"priority": res.priority}) // res.success can be 'undefined'
}
return res
......
......@@ -185,6 +185,7 @@ def upload():
res = {"message": error + mes}
if error:
res['success'] = 'false'
res['priority'] = 3
log.error(res)
else:
log.info(res)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment