Skip to content

Commit

Permalink
Refactor debug logs in alarms.js
Browse files Browse the repository at this point in the history
  • Loading branch information
ivukotic committed Oct 8, 2024
1 parent cdb0f25 commit 99d805d
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions routes/alarms.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,10 +226,13 @@ router.post('/category', jsonParser, async (req, res) => {
body: b,
refresh: true,
});
console.log('Category added.');
console.debug(response);
await loadAlarmTopology();
res.status(200).send('OK');
console.log(`Category adding result: ${response.result}`);
if (response.result === 'created') {
await loadAlarmTopology();
res.status(200).send('OK');
} else {
res.status(500).send(response.result);
}
return;
} catch (err) {
console.error(err);
Expand Down Expand Up @@ -346,7 +349,7 @@ router.delete('/', async (req, res) => {
refresh: true,
});
console.log(`delete response: ${response}`);
if (response.body.deleted > 0) {
if (response.result === 'deleted') {
await loadAlarmTopology();
res.status(200).send('OK');
} else {
Expand Down

0 comments on commit 99d805d

Please sign in to comment.