correct handleSelectMonitors function to align with Search component
This commit is contained in:
1 parent
ee0a02d46e
commit
673df3a7a4
1 file changed
+4
-7
@@ -137,7 +137,7 @@ const CreateMaintenance = () => {
|
|||||||
limit: null,
|
limit: null,
|
||||||
types: ["http", "ping", "pagespeed"],
|
types: ["http", "ping", "pagespeed"],
|
||||||
});
|
});
|
||||||
const monitors = response.data.data.filteredMonitors; //fetching monitor data from fileterdMonitors
|
const monitors = response.data.data.monitors;
|
||||||
setMonitors(monitors);
|
setMonitors(monitors);
|
||||||
|
|
||||||
if (maintenanceWindowId === undefined) {
|
if (maintenanceWindowId === undefined) {
|
||||||
@@ -178,13 +178,10 @@ const CreateMaintenance = () => {
|
|||||||
setSearch(value);
|
setSearch(value);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleSelectMonitors = (event, selectedMonitors) => {
|
const handleSelectMonitors = (monitors) => {
|
||||||
const monitorsArray = Array.isArray(event) ? event : selectedMonitors; // Check if the selected monitors are in event or the selectedMonitors
|
setForm({ ...form, monitors });
|
||||||
if (!monitorsArray) return;
|
|
||||||
|
|
||||||
setForm({ ...form, monitors: monitorsArray }); // Update form state with the selected monitors
|
|
||||||
const { error } = maintenanceWindowValidation.validate(
|
const { error } = maintenanceWindowValidation.validate(
|
||||||
{ monitors: monitorsArray },
|
{ monitors },
|
||||||
{ abortEarly: false }
|
{ abortEarly: false }
|
||||||
);
|
);
|
||||||
setErrors((prev) => {
|
setErrors((prev) => {
|
||||||
|
|||||||
Reference in new issue
Block a user