Refactor network service to use config objects for clarity

This commit is contained in:
Alex Holliday committed 2024-09-22 11:38:42 +08:00
1 parent a8e069b820
commit 1c8376dc24
11 files changed
+325 -286

No files matched your search

@@ -40,16 +40,16 @@ const PaginationTable = ({ monitorId, dateRange }) => {
useEffect(() => {
const fetchPage = async () => {
try {
const res = await networkService.getChecksByMonitor(
authToken,
monitorId,
"desc",
null,
dateRange,
null,
paginationController.page,
paginationController.rowsPerPage
);
const res = await networkService.getChecksByMonitor({
authToken: authToken,
moniotrId: monitorId,
sortOrder: "desc",
limit: null,
dateRange: dateRange,
filter: null,
page: paginationController.page,
rowsPerPage: paginationController.rowsPerPage,
});
setChecks(res.data.data.checks);
setChecksCount(res.data.data.checksCount);
} catch (error) {
+13 -13
View File
@@ -63,15 +63,15 @@ const DetailsPage = ({ isAdmin }) => {
const fetchMonitor = useCallback(async () => {
try {
const res = await networkService.getStatsByMonitorId(
authToken,
monitorId,
null,
null,
dateRange,
50,
true
);
const res = await networkService.getStatsByMonitorId({
authToken: authToken,
monitorId: monitorId,
sortOrder: null,
limit: null,
dateRange: dateRange,
numToDisplay: 50,
normalize: true,
});
setMonitor(res?.data?.data ?? {});
} catch (error) {
logger.error(error);
@@ -89,10 +89,10 @@ const DetailsPage = ({ isAdmin }) => {
return;
}
try {
const res = await networkService.getCertificateExpiry(
authToken,
monitorId
);
const res = await networkService.getCertificateExpiry({
authToken: authToken,
monitorId: monitorId,
});
if (res?.data?.data?.certificateDate) {
let [month, day, year] = res.data.data.certificateDate.split("/");