Files
Checkmate/Client/src/Pages/Monitors/Configure/index.jsx
T

61 lines
1.6 KiB
React
Raw Normal View History

2024-07-19 14:46:26 -04:00
import { useNavigate, useParams } from "react-router";
import { useTheme } from "@emotion/react";
import { useDispatch, useSelector } from "react-redux";
import { useEffect, useState } from "react";
import axiosInstance from "../../../Utils/axiosConfig";
2024-07-19 14:35:11 -04:00
import Button from "../../../Components/Button";
import WestRoundedIcon from "@mui/icons-material/WestRounded";
import "./index.css";
/**
2024-07-19 14:46:26 -04:00
* Configure page displays monitor configurations and allows for editing actions.
2024-07-19 14:35:11 -04:00
* @component
*/
const Configure = () => {
const navigate = useNavigate();
const theme = useTheme();
2024-07-19 14:46:26 -04:00
const dispatch = useDispatch();
const [monitor, setMonitor] = useState();
const { monitorId } = useParams();
const { authToken } = useSelector((state) => state.auth);
useEffect(() => {
const fetchMonitor = async () => {
const res = await axiosInstance.get(`/monitors/${monitorId}`, {
headers: {
Authorization: `Bearer ${authToken}`,
},
});
setMonitor(res.data.data);
};
fetchMonitor();
}, [monitorId, authToken]);
2024-07-19 14:35:11 -04:00
return (
<div
className="configure-monitor"
style={{
maxWidth: "1200px",
padding: `${theme.content.pY} ${theme.content.pX}`,
}}
>
<Button
level="tertiary"
label="Back"
img={<WestRoundedIcon />}
onClick={() => navigate(-1)}
sx={{
backgroundColor: "#f4f4f4",
mb: theme.gap.medium,
px: theme.gap.ml,
"& svg.MuiSvgIcon-root": {
pr: theme.gap.small,
},
}}
/>
</div>
);
};
export default Configure;