updated the component and device api's to have as be a parameter for the function

This commit is contained in:
csawatzky 2025-04-22 14:33:19 -06:00
parent c617ebf868
commit b62c7dbe5c
39 changed files with 346 additions and 651 deletions

View file

@ -11,6 +11,7 @@ import ResponsiveDialog from "common/ResponsiveDialog";
import { useComponentAPI, useSnackbar } from "hooks";
import { Component } from "models";
import { pond } from "protobuf-ts/pond";
import { useGlobalState } from "providers";
// import { MatchParams } from "navigation/Routes";
// import { useRouteMatch } from "react-router";
import { useEffect, useState } from "react";
@ -40,6 +41,7 @@ export default function GraphSettings(props: Props) {
currentMax,
newChart
} = props;
const [{as}] = useGlobalState();
const [newMutation, setNewMutation] = useState<pond.Mutator>(0);
const componentAPI = useComponentAPI();
const deviceID = useParams<{ deviceID: string }>()?.deviceID ?? "";
@ -58,7 +60,7 @@ export default function GraphSettings(props: Props) {
defaultMutations.push(newMutation);
}
componentAPI
.update(parseInt(deviceID), comp.settings)
.update(parseInt(deviceID), comp.settings, undefined, undefined, as)
.then(() => openSnack("Mutations Updated"));
closeDialog();
};
@ -70,7 +72,7 @@ export default function GraphSettings(props: Props) {
defaultMuts.splice(defaultMuts.indexOf(mutation));
}
componentAPI
.update(parseInt(deviceID), comp.settings)
.update(parseInt(deviceID), comp.settings, undefined, undefined, as)
.then(() => openSnack("Mutations Updated"));
closeDialog();
};