Refactor getChecksByUserId to getChecksByTeamId

This commit is contained in:
Alex Holliday committed 2024-08-27 12:22:32 -07:00
1 parent c8c2dfe9ec
commit eedc6bbed6
8 files changed
+27 -31

No files matched your search

@@ -46,9 +46,9 @@ const IncidentTable = ({ monitors, selectedMonitor, filter }) => {
try {
let res;
if (selectedMonitor === "0") {
res = await networkService.getChecksByUser(
res = await networkService.getChecksByTeam(
authToken,
user._id,
user.teamId,
"desc",
null,
null,
+2 -2
View File
@@ -50,14 +50,14 @@ const Incidents = () => {
setLoading(true);
const res = await networkService.getMonitorsByTeamId(
authState.authToken,
authState.user._id,
authState.user.teamId,
1,
null,
null,
null,
null
);
console.log(res);
// Reduce to a lookup object for 0(1) lookup
if (res.data && res.data.data.length > 0) {
const monitorLookup = res.data.data.reduce((acc, monitor) => {
+3 -3
View File
@@ -409,9 +409,9 @@ class NetworkService {
* @returns {Promise<AxiosResponse>} The response from the axios GET request.
*
*/
async getChecksByUser(
async getChecksByTeam(
authToken,
userId,
teamId,
sortOrder,
limit,
dateRange,
@@ -427,7 +427,7 @@ class NetworkService {
if (page) params.append("page", page);
if (rowsPerPage) params.append("rowsPerPage", rowsPerPage);
return this.axiosInstance.get(
`/checks/user/${userId}?${params.toString()}`,
`/checks/team/${teamId}?${params.toString()}`,
{
headers: { Authorization: `Bearer ${authToken}` },
}