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

@ -166,7 +166,8 @@ export default function DeviceComponent() {
false,
getContextKeys(),
getContextTypes(),
showErrors
showErrors,
as
)
.then(resp => {
if (resp.data.measurements) {
@ -179,7 +180,7 @@ export default function DeviceComponent() {
.finally(() => {
setSampling(false);
});
}, [componentAPI, deviceID, componentID, user, startDate, endDate, showErrors]);
}, [componentAPI, deviceID, componentID, user, startDate, endDate, showErrors, as]);
useEffect(() => {
if (live.current && liveSamples) {
@ -206,7 +207,7 @@ export default function DeviceComponent() {
if (user.settings.id === "") return;
setLoadingInitial(true);
deviceAPI
.get(deviceID, false, getContextKeys().slice(0, -1), getContextTypes().slice(0, -1))
.get(deviceID, false, getContextKeys().slice(0, -1), getContextTypes().slice(0, -1), as)
.then((response: any) => {
const rDevice = Device.any(response.data);
setDevice(rDevice);
@ -215,10 +216,11 @@ export default function DeviceComponent() {
false,
getContextKeys(),
getContextTypes(),
true
true,
as
);
let userPromise = userAPI.getUser(user.settings.id, deviceScope(deviceID.toString()));
let prefPromise = deviceAPI.listDeviceComponentPreferences(deviceID, getContextKeys().slice(0, -1), getContextTypes().slice(0, -1));
let prefPromise = deviceAPI.listDeviceComponentPreferences(deviceID, getContextKeys().slice(0, -1), getContextTypes().slice(0, -1), as);
Promise.all([componentsPromise, userPromise, prefPromise])
.then((responses: any) => {
const rawComponents: Array<any> = or(responses[0].data.components, []).sort(
@ -427,7 +429,8 @@ export default function DeviceComponent() {
undefined,
getContextKeys(),
getContextTypes(),
showErrors
showErrors,
as
)
.then(response => {
let total: number = response.data.total ? response.data.total : 0;
@ -458,7 +461,7 @@ export default function DeviceComponent() {
useEffect(() => {
load()
}, [page, pageSize])
}, [page, pageSize, as])
const columns = (): Column<convertedUnitMeasurement>[] => {
return [