Commit 9acc94b7 authored by Jasper Verbeet's avatar Jasper Verbeet 🙇🏻

updates

parent 08cd3f18
......@@ -84,6 +84,7 @@ const twoDigitString = (num) => {
app.get('/api/notification', (req, res) => {
const newItem = getDbItem('opened');
console.log(colors.magenta(`${new Date().toLocaleString()} Polling from app`));
if (!newItem) {
const weightNum = getDbItem('weight') || 0;
......@@ -167,23 +168,6 @@ app.post('/api/accept', (req, res) => {
res.json({result: 'ok'});
});
app.post('/api/details', (req, res) => {
console.log(colors.yellow(`${new Date().toLocaleString()} Polling from app`));
const expected = ['total_weight', 'current_weight', 'long', 'lat',];
const exact = expected.filter((val) => !(val in req.body));
if (exact.length != 0) {
res.status = 400;
return res.json({result: 'error'});
}
setDbItem('total_weight', res.body.total_weight);
setDbItem('long', res.body.long);
setDbItem('lat', res.body.lat);
res.json({result: 'ok'});
});
// START THE SERVER
// =============================================================================
......
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