updated as in the terminal and gate api's

This commit is contained in:
csawatzky 2025-04-17 15:42:19 -06:00
parent 76744c1b6f
commit 74c8ed661c
13 changed files with 109 additions and 75 deletions

View file

@ -1,7 +1,7 @@
import { Button, DialogActions, DialogContent, DialogTitle, TextField } from "@mui/material";
import ResponsiveDialog from "common/ResponsiveDialog";
import { useEffect, useState } from "react";
import { useTerminalAPI } from "providers";
import { useGlobalState, useTerminalAPI } from "providers";
import { useSnackbar } from "hooks";
import { pond } from "protobuf-ts/pond";
import { Terminal } from "models/Terminal";
@ -16,6 +16,7 @@ interface Props {
export default function TerminalSettings(props: Props) {
const { open, closeDialog, terminal, long, lat } = props;
const [{as}] = useGlobalState();
const terminalAPI = useTerminalAPI();
const [name, setName] = useState("");
const { openSnack } = useSnackbar();
@ -35,7 +36,7 @@ export default function TerminalSettings(props: Props) {
terminal.name = name;
//note: changing the terminal object passed in WILL in fact change it in the parent
terminalAPI
.updateTerminal(terminal.key, terminal.name, terminal.settings)
.updateTerminal(terminal.key, terminal.name, terminal.settings, as)
.then(resp => {
openSnack("Terminal updated");
closeDialog();
@ -49,7 +50,7 @@ export default function TerminalSettings(props: Props) {
latitude: lat
});
terminalAPI
.addTerminal(name, settings)
.addTerminal(name, settings, as)
.then(resp => {
openSnack("New terminal added");
let newTerminal = Terminal.create(