update as in site api
This commit is contained in:
parent
1acbfe36b0
commit
59356aad27
6 changed files with 26 additions and 21 deletions
|
|
@ -6,7 +6,7 @@ import { Device, Site } from "models";
|
|||
import { ObjectHeater } from "models/ObjectHeater";
|
||||
import ObjectHeaterCard from "objectHeater/ObjectHeaterCard";
|
||||
import { pond } from "protobuf-ts/pond";
|
||||
import { useObjectHeaterAPI, useSiteAPI, useSnackbar } from "providers";
|
||||
import { useGlobalState, useObjectHeaterAPI, useSiteAPI, useSnackbar } from "providers";
|
||||
import React, { useEffect, useState } from "react";
|
||||
|
||||
interface Props {
|
||||
|
|
@ -34,6 +34,7 @@ export default function SiteDrawer(props: Props) {
|
|||
updateMarker
|
||||
} = props;
|
||||
const [site, setSite] = useState<Site>(Site.create());
|
||||
const [{as}] = useGlobalState();
|
||||
const siteAPI = useSiteAPI();
|
||||
const objectHeaterAPI = useObjectHeaterAPI();
|
||||
const { openSnack } = useSnackbar();
|
||||
|
|
@ -206,7 +207,7 @@ export default function SiteDrawer(props: Props) {
|
|||
let settings = site.settings;
|
||||
settings.theme = newTheme;
|
||||
siteAPI
|
||||
.updateSite(site.key(), settings)
|
||||
.updateSite(site.key(), settings, undefined, as)
|
||||
.then(resp => {
|
||||
openSnack("marker settings updated");
|
||||
updateMarker(site.key(), settings);
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ export default function ConstructionMapController(props: Props) {
|
|||
newSite.settings.latitude = newLat;
|
||||
|
||||
siteAPI
|
||||
.addSite(newSite.settings)
|
||||
.addSite(newSite.settings, as)
|
||||
.then(resp => {
|
||||
openSnack("Added new Site Location");
|
||||
loadSites();
|
||||
|
|
@ -559,7 +559,7 @@ export default function ConstructionMapController(props: Props) {
|
|||
site.settings.longitude = long;
|
||||
site.settings.latitude = lat;
|
||||
siteAPI
|
||||
.updateSite(site.key(), site.settings)
|
||||
.updateSite(site.key(), site.settings, undefined, as)
|
||||
.then(resp => {
|
||||
openSnack("Site location updated");
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue