updated the component and device api's to have as be a parameter for the function
This commit is contained in:
parent
c617ebf868
commit
b62c7dbe5c
39 changed files with 346 additions and 651 deletions
|
|
@ -32,6 +32,7 @@ import { useDeviceAPI, useGroupAPI, usePrevious, useSnackbar } from "hooks";
|
|||
import { Device, Group } from "models";
|
||||
import { filterDevices } from "pbHelpers/Device";
|
||||
import { groupsAreEqual } from "pbHelpers/Group";
|
||||
import { useGlobalState } from "providers";
|
||||
import React, { useCallback, useEffect, useState } from "react";
|
||||
import RemoveGroup from "./RemoveGroup";
|
||||
|
||||
|
|
@ -76,6 +77,7 @@ export default function GroupSettings(props: Props) {
|
|||
groupDevices,
|
||||
} = props;
|
||||
const prevInitialGroup = usePrevious(initialGroup);
|
||||
const [{as}] = useGlobalState();
|
||||
const groupAPI = useGroupAPI();
|
||||
const deviceAPI = useDeviceAPI();
|
||||
const snackbar = useSnackbar()
|
||||
|
|
@ -103,7 +105,7 @@ export default function GroupSettings(props: Props) {
|
|||
const loadDevices = useCallback(() => {
|
||||
setLoadingDevices(true);
|
||||
deviceAPI
|
||||
.list(1000000, 0, "asc")
|
||||
.list(1000000, 0, "asc", undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,as)
|
||||
.then((response: any) => {
|
||||
let rDevices: Device[] = response.data.devices
|
||||
? response.data.devices.map((device: any) => Device.any(device))
|
||||
|
|
@ -115,7 +117,7 @@ export default function GroupSettings(props: Props) {
|
|||
setDevices([]);
|
||||
})
|
||||
.finally(() => setLoadingDevices(false));
|
||||
}, [deviceAPI]);
|
||||
}, [deviceAPI, as]);
|
||||
|
||||
useEffect(() => {
|
||||
if (prevInitialGroup !== initialGroup) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue