Commit 8a41b3e6 authored by Jasper Verbeet's avatar Jasper Verbeet 🙇🏻

Fixes

parent 38930628
......@@ -122,7 +122,7 @@ app.get('/api/notification', (req, res) => {
app.get('/api/status', (req, res) => {
console.log(colors.yellow(`${new Date().toLocaleString()} Polling from website`));
res.json({result: getDbItem('status')});
res.json({result: getDbItem('status'), fuel: getDbItem('fuel')});
});
app.post('/api/shipment', (req, res) => {
......@@ -154,13 +154,14 @@ app.post('/api/shipment', (req, res) => {
app.post('/api/accept', (req, res) => {
const state = req.body['state'];
const fuel = req.body['fuelLevel'];
if (state == null) {
res.status = 400;
return res.json({result: 'supply a `state` in the json body'});
}
console.log(req.body);
setDbItem('fuel', fuel);
if (getDbItem('status') === 0) {
setDbItem('status', state);
......
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