update to mine api for as to be passed in to the functions

This commit is contained in:
csawatzky 2025-04-21 13:24:26 -06:00
parent 022837de87
commit 9b9f4cdf63
9 changed files with 50 additions and 34 deletions

View file

@ -13,6 +13,7 @@ import { LibraryAdd } from "@mui/icons-material";
import ResponsiveTable, { Column } from "common/ResponsiveTable";
import { useNavigate } from "react-router-dom";
import { or } from "utils";
import { useGlobalState } from "providers";
interface MineRow {
mine: pond.Mine;
@ -44,11 +45,12 @@ export default function Mines() {
const [pageSize, setPageSize] = useState(10);
const [mineDialog, setMineDialog] = useState(false);
const [searchValue, setSearchValue] = useState("");
const [{as}] = useGlobalState();
const load = useCallback(() => {
setIsLoading(true);
mineAPI
.listMines(pageSize, pageSize * page, "desc", undefined, searchValue, false)
.listMines(pageSize, pageSize * page, "desc", undefined, searchValue, false, as)
.then(resp => {
let mineData: MineRow[] = [];
resp.data.mines.forEach(mine => {
@ -62,7 +64,7 @@ export default function Mines() {
.finally(() => {
setIsLoading(false);
});
}, [pageSize, page, mineAPI, setIsLoading, searchValue]);
}, [pageSize, page, mineAPI, setIsLoading, searchValue, as]);
useEffect(() => {
load();

View file

@ -13,6 +13,7 @@ import { useMineAPI } from "hooks";
import { Sensor } from "ventilation/drawable/Sensor";
import { useParams } from "react-router-dom";
import { makeStyles } from "@mui/styles";
import { useGlobalState } from "providers";
const useStyles = makeStyles((theme: Theme) => {
return ({
@ -78,6 +79,7 @@ export default function Ventilation() {
>(new Map());
const [sensors, setSensors] = useState<Sensor[]>([]);
const [componentDevices, setComponentDevices] = useState<Map<string, number>>(new Map());
const [{as}] = useGlobalState();
const handleResize = (node: any) => {
setHeight(node.getBoundingClientRect().height);
@ -96,7 +98,7 @@ export default function Ventilation() {
if (!mineKey) return;
setLoading(true);
mineAPI
.getMine(mineKey)
.getMine(mineKey, as)
.then((resp: { data: pond.IGetMineResponse | undefined; }) => {
if (resp.data && resp.data.mine && resp.data.mine.settings) {
let data = pond.GetMineResponse.create(resp.data);