Refactored axios util into a service

This commit is contained in:
Alex Holliday committed 2024-08-18 17:42:49 -07:00
1 parent 92877e20ec
commit 20e4c7ef07
14 files changed
+293 -289

No files matched your search

@@ -13,7 +13,7 @@ import {
import { useState, useEffect } from "react";
import { useSelector } from "react-redux";
import axiosInstance from "../../../../Utils/NetworkService";
import { networkService } from "../../../../main";
import { StatusLabel } from "../../../../Components/Label";
import ArrowBackRoundedIcon from "@mui/icons-material/ArrowBackRounded";
import ArrowForwardRoundedIcon from "@mui/icons-material/ArrowForwardRounded";
@@ -37,7 +37,7 @@ const PaginationTable = ({ monitorId, dateRange }) => {
useEffect(() => {
const fetchPage = async () => {
try {
const res = await axiosInstance.getChecksByMonitor(
const res = await networkService.getChecksByMonitor(
authToken,
monitorId,
"desc",
+3 -3
View File
@@ -3,7 +3,7 @@ import PropTypes from "prop-types";
import { Box, Skeleton, Stack, Typography, useTheme } from "@mui/material";
import { useSelector } from "react-redux";
import { useNavigate, useParams } from "react-router-dom";
import axiosInstance from "../../../Utils/NetworkService";
import { networkService } from "../../../main";
import MonitorDetailsAreaChart from "../../../Components/Charts/MonitorDetailsAreaChart";
import ButtonGroup from "@mui/material/ButtonGroup";
import Button from "../../../Components/Button";
@@ -121,7 +121,7 @@ const DetailsPage = () => {
const fetchMonitor = useCallback(async () => {
try {
const res = await axiosInstance.getStatsByMonitorId(
const res = await networkService.getStatsByMonitorId(
authToken,
monitorId,
null,
@@ -144,7 +144,7 @@ const DetailsPage = () => {
useEffect(() => {
const fetchCertificate = async () => {
const res = await axiosInstance.getCertificateExpiry(
const res = await networkService.getCertificateExpiry(
authToken,
monitorId
);