refactor networkSerivce.getMonitorsByTeamId to take a config objet

This commit is contained in:
Alex Holliday committed 2024-09-18 10:57:44 +08:00
1 parent cab023709b
commit 4748afb93a
5 files changed
+74 -58

No files matched your search

+14 -11
View File
@@ -25,17 +25,20 @@ const Incidents = () => {
useEffect(() => {
const fetchMonitors = async () => {
setLoading(true);
const res = await networkService.getMonitorsByTeamId(
authState.authToken,
authState.user.teamId,
-1,
null,
null,
null,
null,
null,
null
);
const res = await networkService.getMonitorsByTeamId({
authToken: authState.authToken,
teamId: authState.user.teamId,
limit: -1,
types: null,
status: null,
checkOrder: null,
normalize: null,
page: null,
rowsPerPage: null,
filter: null,
field: null,
order: null,
});
// Reduce to a lookup object for 0(1) lookup
if (res?.data?.data?.monitors?.length > 0) {
const monitorLookup = res.data.data.monitors.reduce((acc, monitor) => {