fix bug with auto conversion of array to object for monitor criteria

This commit is contained in:
deityhub 2021-02-18 22:21:40 +01:00
parent 0041a4c85c
commit fcc67c9aa8
2 changed files with 7 additions and 2 deletions

View File

@ -136,7 +136,12 @@ router.get('/monitors', isAuthorizedProbe, async function(req, res) {
global.io.emit(`updateProbe-${projectId}`, probe);
}
}
return sendListResponse(req, res, monitors, monitors.length);
return sendListResponse(
req,
res,
JSON.stringify(monitors),
monitors.length
);
} catch (error) {
return sendErrorResponse(req, res, error);
}

View File

@ -19,7 +19,7 @@ module.exports = {
runJob: async function() {
try {
let monitors = await getApi('probe/monitors');
monitors = monitors.data;
monitors = JSON.parse(monitors.data); // parse the stringified data
await Promise.all(
monitors.map(monitor => {
if (monitor.type === 'api') {