diff --git a/server/src/routes/analytic_units_router.ts b/server/src/routes/analytic_units_router.ts index 84d3e76..ec00763 100644 --- a/server/src/routes/analytic_units_router.ts +++ b/server/src/routes/analytic_units_router.ts @@ -8,15 +8,13 @@ import { saveTargets } from '../controllers/metrics_controler'; async function sendStatus(ctx: Router.IRouterContext) { try { let id = ctx.request.query.id; - let name = ctx.request.query.name; - if(id === undefined) { throw new Error('Id is undefined'); } let unit = AnalyticUnit.findById(id); if(unit.status === undefined) { - throw new Error('No status for ' + name); + throw new Error('status is undefined'); } ctx.response.body = { status: unit.status, errorMessage: unit.error }; } catch(e) { diff --git a/server/src/services/notification_service.ts b/server/src/services/notification_service.ts index 97bba99..4b39a6b 100644 --- a/server/src/services/notification_service.ts +++ b/server/src/services/notification_service.ts @@ -3,6 +3,7 @@ import { findById } from '../models/analytic_unit'; import axios from 'axios'; +// TODO: send notification with payload without dep to AnalyticUnit export async function sendNotification(predictorId, active) { let anomalyName = findById(predictorId).name; console.log('Notification ' + anomalyName); @@ -31,7 +32,7 @@ export async function sendNotification(predictorId, active) { }) console.log(data); } catch(err) { - console.error(`Can't send alert to ${endpoint}. Error: ${err}`) + console.error(`Can't send alert to ${endpoint}. Error: ${err}`); } }