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,
|
||||
};
|
||||
|
||||
console.log(monitor);
|
||||
const { error } = createMonitorValidation.validate(monitor, {
|
||||
abortEarly: false,
|
||||
});
|
||||
|
||||
// const { error } = createMonitorValidation.validate(monitor, {
|
||||
// abortEarly: false,
|
||||
// });
|
||||
|
||||
// if (error) {
|
||||
// const newErrors = {};
|
||||
// error.details.forEach((err) => {
|
||||
// newErrors[err.path[0]] = err.message;
|
||||
// });
|
||||
// setErrors(newErrors);
|
||||
// } else {
|
||||
// monitor = {
|
||||
// ...monitor,
|
||||
// description: monitor.name,
|
||||
// userId: user._id,
|
||||
// // ...advancedSettings, // TODO frequency should be interval, then we can use spread
|
||||
// interval: advancedSettings.frequency * MS_PER_MINUTE,
|
||||
// };
|
||||
// try {
|
||||
// const action = await dispatch(createMonitor({ authToken, monitor }));
|
||||
// if (action.meta.requestStatus === "fulfilled") {
|
||||
// navigate("/monitors");
|
||||
// }
|
||||
// } catch (error) {
|
||||
// alert(error);
|
||||
// }
|
||||
// }
|
||||
if (error) {
|
||||
const newErrors = {};
|
||||
error.details.forEach((err) => {
|
||||
newErrors[err.path[0]] = err.message;
|
||||
});
|
||||
setErrors(newErrors);
|
||||
} else {
|
||||
monitor = {
|
||||
...monitor,
|
||||
description: monitor.name,
|
||||
userId: user._id,
|
||||
// ...advancedSettings, // TODO frequency should be interval, then we can use spread
|
||||
interval: advancedSettings.frequency * MS_PER_MINUTE,
|
||||
};
|
||||
try {
|
||||
const action = await dispatch(createMonitor({ authToken, monitor }));
|
||||
if (action.meta.requestStatus === "fulfilled") {
|
||||
navigate("/monitors");
|
||||
}
|
||||
} catch (error) {
|
||||
alert(error);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
//select values
|
||||
|
||||
Reference in new issue
Block a user