updated as in the terminal and gate api's
This commit is contained in:
parent
76744c1b6f
commit
74c8ed661c
13 changed files with 109 additions and 75 deletions
|
|
@ -132,7 +132,7 @@ export default function Gate(props: Props) {
|
|||
if (loadingGate || id === undefined || id === "") return;
|
||||
setLoadingGate(true);
|
||||
gateAPI
|
||||
.getGatePageData(id)
|
||||
.getGatePageData(id, as)
|
||||
.then(resp => {
|
||||
//console.log(resp.data);
|
||||
let p = new Map<number, pond.GateDeviceType>();
|
||||
|
|
@ -168,7 +168,7 @@ export default function Gate(props: Props) {
|
|||
setLoadingGate(false);
|
||||
});
|
||||
//eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [gateAPI, gateID]);
|
||||
}, [gateAPI, gateID, as]);
|
||||
|
||||
useEffect(() => {
|
||||
loadGate();
|
||||
|
|
@ -176,7 +176,7 @@ export default function Gate(props: Props) {
|
|||
|
||||
const updateGateDevicePrefs = (deviceID: number, newPref: pond.GateDeviceType) => {
|
||||
gateAPI
|
||||
.updatePrefs(gate.key, "device", deviceID.toString(), newPref, [gate.key], ["gate"])
|
||||
.updatePrefs(gate.key, "device", deviceID.toString(), newPref, [gate.key], ["gate"], as)
|
||||
.then(resp => {
|
||||
openSnack("Updated gate device type");
|
||||
// have to do the clone method to force the select box to update
|
||||
|
|
@ -226,7 +226,7 @@ export default function Gate(props: Props) {
|
|||
"write",
|
||||
"grant",
|
||||
"revoke"
|
||||
])
|
||||
], as)
|
||||
.then(resp => {
|
||||
if (id) {
|
||||
devMap.set(id.toString(), device);
|
||||
|
|
@ -238,7 +238,7 @@ export default function Gate(props: Props) {
|
|||
console.log("error linking device");
|
||||
});
|
||||
} else {
|
||||
gateAPI.updateLink(gateID, "gate", id.toString(), "device", []).then(resp => {
|
||||
gateAPI.updateLink(gateID, "gate", id.toString(), "device", [], as).then(resp => {
|
||||
if (id) {
|
||||
devMap.delete(id.toString());
|
||||
if (tabVal === id) {
|
||||
|
|
@ -264,14 +264,14 @@ export default function Gate(props: Props) {
|
|||
"write",
|
||||
"grant",
|
||||
"revoke"
|
||||
])
|
||||
],as)
|
||||
.then(resp => {
|
||||
c.push(component);
|
||||
setComponents([...c]);
|
||||
});
|
||||
} else {
|
||||
gateAPI
|
||||
.updateLink(gateID, "gate", deviceID + ":" + component.key(), "component", [])
|
||||
.updateLink(gateID, "gate", deviceID + ":" + component.key(), "component", [], as)
|
||||
.then(resp => {
|
||||
c.forEach((comp, i) => {
|
||||
if (component.key() === comp.key()) {
|
||||
|
|
|
|||
|
|
@ -181,14 +181,14 @@ export default function Terminals(props: Props) {
|
|||
const load = useCallback(() => {
|
||||
if(loading) return
|
||||
setLoading(true)
|
||||
terminalAPI.listTerminals(200, 0, "asc", "name").then(resp => {
|
||||
terminalAPI.listTerminals(200, 0, "asc", "name", as).then(resp => {
|
||||
setTerminals(resp.data.terminals.map(a => Terminal.any(a)));
|
||||
}).catch(err => {
|
||||
console.log("There was a problem loading Terminals")
|
||||
}).finally(() => {
|
||||
setLoading(false)
|
||||
})
|
||||
}, [terminalAPI, openSnack]); //eslint-disable-line react-hooks/exhaustive-deps
|
||||
}, [terminalAPI, openSnack, as]); //eslint-disable-line react-hooks/exhaustive-deps
|
||||
|
||||
useEffect(() => {
|
||||
load();
|
||||
|
|
@ -197,7 +197,7 @@ export default function Terminals(props: Props) {
|
|||
const remove = () => {
|
||||
if (currentTerminal) {
|
||||
terminalAPI
|
||||
.removeTerminal(currentTerminal.key)
|
||||
.removeTerminal(currentTerminal.key, as)
|
||||
.then(resp => {
|
||||
openSnack("Terminal Deleted");
|
||||
let a = terminals;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue