checking if groupID is undefined before trying to use it
This commit is contained in:
parent
35045860c1
commit
6ee7aa95a9
1 changed files with 10 additions and 4 deletions
|
|
@ -78,12 +78,18 @@ export default function DeviceOverview(props: Props) {
|
|||
}, [components, prevComponents]);
|
||||
|
||||
const pathToDevice = () => {
|
||||
const groupID = parseInt(useParams().groupID ?? "0", 10);
|
||||
console.log(groupID)
|
||||
if (useParams().groupID) {
|
||||
const groupID = parseInt(useParams().groupID ?? "0", 10);
|
||||
const groupPath: string = groupID > 0 ? "/groups/" + groupID.toString() : "";
|
||||
const devicePath: string = "/devices/" + device.settings.deviceId.toString();
|
||||
return groupPath + devicePath;
|
||||
}
|
||||
// const groupID = parseInt(useParams().groupID ?? "0", 10);
|
||||
// console.log(groupID)
|
||||
// const groupID: number = parseInt(match.params.groupID, 10);
|
||||
const groupPath: string = groupID > 0 ? "/groups/" + groupID.toString() : "";
|
||||
// const groupPath: string = groupID > 0 ? "/groups/" + groupID.toString() : "";
|
||||
const devicePath: string = "/devices/" + device.settings.deviceId.toString();
|
||||
return groupPath + devicePath;
|
||||
return devicePath;
|
||||
};
|
||||
|
||||
const copySim = (sim: string) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue