sharing and UX improvements

This commit is contained in:
glmdev
2019-06-23 12:17:35 -05:00
parent 1bd6ad1830
commit 2a80e65c35
14 changed files with 473 additions and 56 deletions

View File

@@ -38,9 +38,22 @@ class v1 {
error: 'Missing data.'
})
}
const data = JSON.parse(req.body.data)
let data
try {
data = JSON.parse(req.body.data)
}
catch (e){
return res.status(400).send({
success: false,
error: 'Invalid JSON.'
})
}
if ( !data.brief ){
data.brief = 'Breakpoint. (No Message.)'
}
const out = new Out({
brief: data.brief,
data: JSON.stringify(data.data),
@@ -55,4 +68,4 @@ class v1 {
}
}
module.exports = exports = v1
module.exports = exports = v1