diff --git a/src/pages/Devices.tsx b/src/pages/Devices.tsx index 3425c00..327d72d 100644 --- a/src/pages/Devices.tsx +++ b/src/pages/Devices.tsx @@ -120,14 +120,15 @@ export default function Devices() { setGroups(newGroups); }; - const getGroupKey = () => { - return parseInt(tab+1) + const getGroup = () => { + let group = groups[parseInt(tab)] + return group } useEffect(() => { setGroupPermissions([]) if (tab === "all") return - groupAPI.getGroupPermissions(getGroupKey()).then(resp => { + groupAPI.getGroupPermissions(getGroup().id()).then(resp => { console.log(resp) setGroupPermissions(resp.data.permissions) }) @@ -160,7 +161,7 @@ export default function Devices() { if (tab !== "all") { let keys = getContextKeys() //keys.splice(keys.length - 1, 0, getGroup().id().toString()); - keys.push(getGroupKey().toString()); + keys.push(getGroup().id().toString()); return keys } else { return getContextKeys() @@ -380,11 +381,6 @@ export default function Devices() { ) } - const getGroup = () => { - let group = groups[parseInt(tab+1)] - return group - } - const mobile = (row: Device) => { return (