Refactored remaining requests

This commit is contained in:
Alex Holliday committed 2024-08-18 17:18:16 -07:00
1 parent f78e5ca94c
commit 92877e20ec
10 files changed
+174 -66

No files matched your search

@@ -43,17 +43,30 @@ const IncidentTable = ({ monitors, selectedMonitor, filter }) => {
return;
}
try {
let url = `/checks/${selectedMonitor}?sortOrder=desc&filter=${filter}&page=${paginationController.page}&rowsPerPage=${paginationController.rowsPerPage}`;
let res;
if (selectedMonitor === "0") {
url = `/checks/user/${user._id}?sortOrder=desc&filter=${filter}&page=${paginationController.page}&rowsPerPage=${paginationController.rowsPerPage}`;
res = await axiosInstance.getChecksByUser(
authToken,
user._id,
"desc",
null,
null,
filter,
paginationController.page,
paginationController.rowsPerPage
);
} else {
res = await axiosInstance.getChecksByMonitor(
authToken,
selectedMonitor,
"desc",
null,
null,
filter,
paginationController.page,
paginationController.rowsPerPage
);
}
const res = await axiosInstance.get(url, {
headers: {
Authorization: `Bearer ${authToken}`,
},
});
setChecks(res.data.data.checks);
setChecksCount(res.data.data.checksCount);
} catch (error) {