update network service to handle all monitors properly

This commit is contained in:
Vishnu Sreekumaran Nair committed 2025-03-15 01:38:52 -04:00
1 parent f4e56008df
commit c07f68dfb1
2 files changed
+5 -4

No files matched your search

@@ -103,7 +103,8 @@ export const updateInfrastructureMonitor = createAsyncThunk(
description: monitor.description, description: monitor.description,
interval: monitor.interval, interval: monitor.interval,
notifications: monitor.notifications, notifications: monitor.notifications,
threshold: monitor.threshold, thresholds: monitor.thresholds,
secret: monitor.secret,
}; };
const res = await networkService.updateMonitor({ const res = await networkService.updateMonitor({
monitorId, monitorId,
+3 -3
View File
@@ -257,14 +257,14 @@ class NetworkService {
* @returns {Promise<AxiosResponse>} The response from the axios PUT request. * @returns {Promise<AxiosResponse>} The response from the axios PUT request.
*/ */
async updateMonitor(config) { async updateMonitor(config) {
const { monitorId, monitor } = config; const { monitorId, monitor, updatedFields } = config;
const updatedFields = { const payload = updatedFields ?? {
name: monitor.name, name: monitor.name,
description: monitor.description, description: monitor.description,
interval: monitor.interval, interval: monitor.interval,
notifications: monitor.notifications, notifications: monitor.notifications,
}; };
return this.axiosInstance.put(`/monitors/${monitorId}`, updatedFields, { return this.axiosInstance.put(`/monitors/${monitorId}`, payload, {
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",
}, },