some hotfixes for construction so that the url navigation is correct when clicking on a card and an undefined error when loading heater data
This commit is contained in:
parent
d9bcd07c8d
commit
4342e1f27b
4 changed files with 7 additions and 12 deletions
|
|
@ -21,6 +21,7 @@ import { pond } from "protobuf-ts/pond";
|
|||
import React, { useEffect, useState } from "react";
|
||||
import { makeStyles } from "@mui/styles";
|
||||
import { useGlobalState } from "providers";
|
||||
import { getContextKeys, getContextTypes } from "pbHelpers/Context";
|
||||
|
||||
interface TabPanelProps {
|
||||
children?: React.ReactNode;
|
||||
|
|
@ -116,13 +117,7 @@ export default function DeviceLinkDrawer(props: Props) {
|
|||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
true,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
as
|
||||
true
|
||||
)
|
||||
.then(resp => {
|
||||
let devMap = new Map<string, pond.ComprehensiveDevice>();
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ export default function ObjectHeaterCard(props: Props) {
|
|||
});
|
||||
}
|
||||
}
|
||||
if (heaterData.devices[0]) {
|
||||
if (heaterData.devices && heaterData.devices[0]) {
|
||||
setConnectedDevice(Device.any(heaterData.devices[0].device));
|
||||
heaterData.devices[0].components.forEach(c => {
|
||||
//loop through the components and assign them accordingly
|
||||
|
|
@ -171,7 +171,7 @@ export default function ObjectHeaterCard(props: Props) {
|
|||
|
||||
const goToHeater = () => {
|
||||
//history.push("/objectHeaters/" + heater.key);
|
||||
let path = "/objectHeaters/" + heater.key;
|
||||
let path = "/heaters/" + heater.key;
|
||||
navigate(path, { state: {heater: heater} });
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -56,8 +56,8 @@ export default function Site() {
|
|||
siteAPI
|
||||
.getSitePage(siteKey, as)
|
||||
.then(resp => {
|
||||
setSite(ISite.any(resp.data.site));
|
||||
setHeaters(resp.data.heaterData);
|
||||
if(resp.data.site) setSite(ISite.any(resp.data.site));
|
||||
if(resp.data.heaterData) setHeaters(resp.data.heaterData);
|
||||
setLoadingSite(false);
|
||||
})
|
||||
.catch(err => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue