fixed issue with adding devices to group
This commit is contained in:
parent
765ac72431
commit
539dd667c7
3 changed files with 13 additions and 24 deletions
|
|
@ -151,7 +151,6 @@ export default function GroupSettings(props: Props) {
|
|||
.then((response: any) => {
|
||||
success(groupName + " was successfully created");
|
||||
close();
|
||||
console.log(response)
|
||||
group.settings.groupId = parseInt(response.data.id)
|
||||
if (addGroupCallback) addGroupCallback(group.settings)
|
||||
else refreshCallback();
|
||||
|
|
@ -232,9 +231,11 @@ export default function GroupSettings(props: Props) {
|
|||
};
|
||||
|
||||
const changeDevices = (device: number) => {
|
||||
console.log("change")
|
||||
let updatedGroup = Group.clone(group);
|
||||
const exists = updatedGroup.settings.devices.includes(device);
|
||||
if (exists) {
|
||||
console.log("exists")
|
||||
updatedGroup.settings.devices = updatedGroup.settings.devices.filter(
|
||||
groupDevice => groupDevice !== device
|
||||
);
|
||||
|
|
@ -328,7 +329,7 @@ export default function GroupSettings(props: Props) {
|
|||
<Checkbox
|
||||
edge="end"
|
||||
onChange={() => changeDevices(device.id())}
|
||||
checked={groupDeviceNumbers.includes(device.id())}
|
||||
checked={group.settings.devices.includes(device.id())}
|
||||
inputProps={{ "aria-labelledby": label }}
|
||||
disabled={!canEdit}
|
||||
/>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue