modified th api's for bin, contract and task to have as passed in as a prop and not get it ffrom the global state directly in the api

This commit is contained in:
csawatzky 2025-04-17 13:33:27 -06:00
parent 4bcac4e346
commit e2f5eb0557
31 changed files with 155 additions and 507 deletions

View file

@ -2,7 +2,7 @@ import { Button, Grid2 as Grid, InputAdornment, TextField } from "@mui/material"
import SearchSelect, { Option } from "common/SearchSelect";
import { GrainOptions } from "grain";
import { pond } from "protobuf-ts/pond";
import { useBinAPI, useSnackbar } from "providers";
import { useBinAPI, useGlobalState, useSnackbar } from "providers";
import React, { useState } from "react";
import { fahrenheitToCelsius, getDistanceUnit, getTemperatureUnit } from "utils";
@ -19,6 +19,7 @@ export default function BulkBinSettings(props: Props) {
const gridItemWidth = 3;
// bin settings variables
const [name, setName] = useState<string | undefined>();
const [{as}] = useGlobalState();
const [grainType, setGrainType] = useState<pond.Grain | undefined>();
const [grainOption, setGrainOption] = useState<Option | null>();
const [height, setHeight] = useState<number | undefined>();
@ -70,7 +71,7 @@ export default function BulkBinSettings(props: Props) {
}
});
binAPI
.bulkBinUpdate(binsToEdit)
.bulkBinUpdate(binsToEdit, as)
.then(resp => {
if (resp.data.successfull > 0) {
refreshCallback(true);