Removed comment, uncommented code
This commit is contained in:
1 parent
2a9d9c3281
commit
958a342875
1 file changed
+26
-28
@@ -92,35 +92,33 @@ const CreateMonitor = () => {
|
|||||||
...checks,
|
...checks,
|
||||||
};
|
};
|
||||||
|
|
||||||
console.log(monitor);
|
const { error } = createMonitorValidation.validate(monitor, {
|
||||||
|
abortEarly: false,
|
||||||
|
});
|
||||||
|
|
||||||
// const { error } = createMonitorValidation.validate(monitor, {
|
if (error) {
|
||||||
// abortEarly: false,
|
const newErrors = {};
|
||||||
// });
|
error.details.forEach((err) => {
|
||||||
|
newErrors[err.path[0]] = err.message;
|
||||||
// if (error) {
|
});
|
||||||
// const newErrors = {};
|
setErrors(newErrors);
|
||||||
// error.details.forEach((err) => {
|
} else {
|
||||||
// newErrors[err.path[0]] = err.message;
|
monitor = {
|
||||||
// });
|
...monitor,
|
||||||
// setErrors(newErrors);
|
description: monitor.name,
|
||||||
// } else {
|
userId: user._id,
|
||||||
// monitor = {
|
// ...advancedSettings, // TODO frequency should be interval, then we can use spread
|
||||||
// ...monitor,
|
interval: advancedSettings.frequency * MS_PER_MINUTE,
|
||||||
// description: monitor.name,
|
};
|
||||||
// userId: user._id,
|
try {
|
||||||
// // ...advancedSettings, // TODO frequency should be interval, then we can use spread
|
const action = await dispatch(createMonitor({ authToken, monitor }));
|
||||||
// interval: advancedSettings.frequency * MS_PER_MINUTE,
|
if (action.meta.requestStatus === "fulfilled") {
|
||||||
// };
|
navigate("/monitors");
|
||||||
// try {
|
}
|
||||||
// const action = await dispatch(createMonitor({ authToken, monitor }));
|
} catch (error) {
|
||||||
// if (action.meta.requestStatus === "fulfilled") {
|
alert(error);
|
||||||
// navigate("/monitors");
|
}
|
||||||
// }
|
}
|
||||||
// } catch (error) {
|
|
||||||
// alert(error);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//select values
|
//select values
|
||||||
|
|||||||
Reference in new issue
Block a user