updated the bin yard api with as fix

This commit is contained in:
csawatzky 2025-04-17 14:35:24 -06:00
parent e2f5eb0557
commit 76744c1b6f
5 changed files with 26 additions and 22 deletions

View file

@ -344,7 +344,7 @@ export default function BinSettings(props: Props) {
setBinYardOptions(y);
} else {
binYardAPI
.listBinYards(350, 0, "desc", as ? as : userID)
.listBinYards(350, 0, "desc", as ? as : userID, undefined, undefined, undefined, as)
.then(resp => {
let data = resp.data.yard ? resp.data.yard : [];
let yards: Option[] = data.map((yard: pond.BinYard) => {

View file

@ -210,7 +210,7 @@ export default function BinYard(props: Props) {
const [leaving, setLeaving] = useState<boolean>(false);
const [yardPermissions, setYardPermissions] = useState<Dictionary<pond.Permission[]>>({});
const [searchSelected, setSearchSelected] = useState(false);
const [{ user }] = useGlobalState();
const [{ user, as }] = useGlobalState();
const [addingYard, setAddingYard] = useState(false)
useEffect(() => {
@ -240,7 +240,7 @@ export default function BinYard(props: Props) {
newBinYard.description = addYardDescription;
newBinYard.owner = user.id();
binYardAPI
.addBinYard(newBinYard)
.addBinYard(newBinYard, as)
.then(resp => {
// loadYards();
let newYards = [...binYards]
@ -271,7 +271,7 @@ export default function BinYard(props: Props) {
newBinYard.name = addYardName;
newBinYard.description = addYardDescription;
binYardAPI
.updateBinYard(newBinYard.key, newBinYard)
.updateBinYard(newBinYard.key, newBinYard, undefined, as)
.then(_resp => {
loadYards();
openSnackbar("success", "Bin Yard updated");
@ -355,7 +355,7 @@ export default function BinYard(props: Props) {
const deleteYard = (index: number) => {
let newBinYards = binYards;
binYardAPI
.removeBinYard(binYards[index].key)
.removeBinYard(binYards[index].key, as)
.then(_resp => {
newBinYards.splice(index, 1);
if (index + 1 === tab) {