Skip to content

Commit 49bcb6c

Browse files
author
Your Name
committed
npm run format
1 parent f07468a commit 49bcb6c

File tree

16 files changed

+39
-503
lines changed

16 files changed

+39
-503
lines changed

client/src/Hooks/useFetchData.js

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2,40 +2,40 @@ import { useEffect, useState } from "react";
22
import { createToast } from "../Utils/toastUtils";
33

44
export const useFetchData = ({
5-
requestFn, // API function
6-
enabled = true,
7-
deps = [],
8-
shouldRun = true, // extra check like monitorId/type
5+
requestFn, // API function
6+
enabled = true,
7+
deps = [],
8+
shouldRun = true, // extra check like monitorId/type
99
}) => {
10-
const [data, setData] = useState(undefined);
11-
const [count, setCount] = useState(undefined);
12-
const [isLoading, setIsLoading] = useState(false);
13-
const [networkError, setNetworkError] = useState(false);
10+
const [data, setData] = useState(undefined);
11+
const [count, setCount] = useState(undefined);
12+
const [isLoading, setIsLoading] = useState(false);
13+
const [networkError, setNetworkError] = useState(false);
1414

15-
useEffect(() => {
16-
const fetchData = async () => {
17-
if (!enabled || !shouldRun) return;
15+
useEffect(() => {
16+
const fetchData = async () => {
17+
if (!enabled || !shouldRun) return;
1818

19-
try {
20-
setIsLoading(true);
21-
const res = await requestFn();
22-
// Support both list and summary
23-
if (res.data?.data?.checks) {
24-
setData(res.data.data.checks);
25-
setCount(res.data.data.checksCount);
26-
} else {
27-
setData(res.data.data);
28-
}
29-
} catch (error) {
30-
setNetworkError(true);
31-
createToast({ body: error.message });
32-
} finally {
33-
setIsLoading(false);
34-
}
35-
};
19+
try {
20+
setIsLoading(true);
21+
const res = await requestFn();
22+
// Support both list and summary
23+
if (res.data?.data?.checks) {
24+
setData(res.data.data.checks);
25+
setCount(res.data.data.checksCount);
26+
} else {
27+
setData(res.data.data);
28+
}
29+
} catch (error) {
30+
setNetworkError(true);
31+
createToast({ body: error.message });
32+
} finally {
33+
setIsLoading(false);
34+
}
35+
};
3636

37-
fetchData();
38-
}, deps); // dependencies passed from hook
37+
fetchData();
38+
}, deps); // dependencies passed from hook
3939

40-
return [data, count, isLoading, networkError];
40+
return [data, count, isLoading, networkError];
4141
};

client/src/Pages/Account/EditUser/hooks/editUser.js

Lines changed: 0 additions & 102 deletions
This file was deleted.

client/src/Pages/Auth/hooks/useValidatePassword.jsx

Lines changed: 0 additions & 70 deletions
This file was deleted.

client/src/Pages/Infrastructure/Details/Components/AreaChartBoxes/InfraAreaChart.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import BaseContainer from "../BaseContainer";
44
import AreaChart from "../../../../../Components/Charts/AreaChart";
55
// Utils
66
import { useTheme } from "@emotion/react";
7-
import { useHardwareUtils } from "../../Hooks/useHardwareUtils";
7+
import { useHardwareUtils } from "../../../../../Hooks/useHardwareUtils";
88
const InfraAreaChart = ({ config }) => {
99
const theme = useTheme();
1010
const { getDimensions } = useHardwareUtils();

client/src/Pages/Infrastructure/Details/Components/AreaChartBoxes/index.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {
1111
TemperatureTooltip,
1212
} from "../../../../../Components/Charts/Utils/chartUtils";
1313
import { useTheme } from "@emotion/react";
14-
import { useHardwareUtils } from "../../Hooks/useHardwareUtils";
14+
import { useHardwareUtils } from "../../../../../Hooks/useHardwareUtils";
1515
import { useTranslation } from "react-i18next";
1616
const AreaChartBoxes = ({ shouldRender, monitor, dateRange }) => {
1717
const theme = useTheme();

client/src/Pages/Infrastructure/Details/Components/BaseContainer/index.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { Box } from "@mui/material";
1111

1212
// Utils
1313
import { useTheme } from "@emotion/react";
14-
import { useHardwareUtils } from "../../Hooks/useHardwareUtils";
14+
import { useHardwareUtils } from "../../../../../Hooks/useHardwareUtils";
1515
import PropTypes from "prop-types";
1616

1717
const BaseContainer = ({ children, sx = {} }) => {

client/src/Pages/Infrastructure/Details/Components/GaugeBoxes/index.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import SkeletonLayout from "./skeleton";
55
import PropTypes from "prop-types";
66

77
// Utils
8-
import { useHardwareUtils } from "../../Hooks/useHardwareUtils";
8+
import { useHardwareUtils } from "../../../../../Hooks/useHardwareUtils";
99
import { useTheme } from "@emotion/react";
1010
import { useTranslation } from "react-i18next";
1111

client/src/Pages/Infrastructure/Details/Components/StatusBoxes/index.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import StatBox from "../../../../../Components/StatBox";
55

66
//Utils
77
import { useMonitorUtils } from "../../../../../Hooks/useMonitorUtils";
8-
import { useHardwareUtils } from "../../Hooks/useHardwareUtils";
8+
import { useHardwareUtils } from "../../../../../Hooks/useHardwareUtils";
99
import { useTranslation } from "react-i18next";
1010

1111
const InfraStatBoxes = ({ shouldRender, monitor }) => {

0 commit comments

Comments
 (0)