Add thunks for adding and removing demo monitors

This commit is contained in:
Alex Holliday committed 2024-09-11 12:03:13 +08:00
1 parent 65cc70cbdd
commit c35157ffb4
4 files changed
+150 -6

No files matched your search

+2
View File
@@ -368,6 +368,7 @@ const deleteMonitor = async (req, res, next) => {
const deleteAllMonitors = async (req, res) => {
try {
console.log("WTF");
const token = getTokenFromHeaders(req.headers);
const { teamId } = jwt.verify(token, process.env.JWT_SECRET);
const { monitors, deletedCount } = await req.db.deleteAllMonitors(teamId);
@@ -384,6 +385,7 @@ const deleteAllMonitors = async (req, res) => {
.json({ success: true, msg: `Deleted ${deletedCount} monitors` });
} catch (error) {
error.service = SERVICE_NAME;
error.method === undefined && error.method === "deleteAllMonitors";
next(error);
}
};