updated the bin yard api with as fix
This commit is contained in:
parent
e2f5eb0557
commit
76744c1b6f
5 changed files with 26 additions and 22 deletions
|
|
@ -3,7 +3,7 @@ import DisplayDrawer from "common/DisplayDrawer";
|
|||
import MapMarkerSettings from "maps/MapMarkerSettings";
|
||||
//import Bins from "pages/Bins";
|
||||
import { pond } from "protobuf-ts/pond";
|
||||
import { useBinYardAPI, useSnackbar } from "providers";
|
||||
import { useBinYardAPI, useGlobalState, useSnackbar } from "providers";
|
||||
import React, { useEffect, useState } from "react";
|
||||
|
||||
interface Props {
|
||||
|
|
@ -18,6 +18,7 @@ interface Props {
|
|||
|
||||
export default function BinYardDrawer(props: Props) {
|
||||
const { open, onClose, selectedYard, yards, removeMarker, updateMarker, moveMap } = props;
|
||||
const [{as}] = useGlobalState();
|
||||
const [yard, setYard] = useState<pond.BinYardSettings>(pond.BinYardSettings.create());
|
||||
const [openMarkerSettings, setOpenMarkerSettings] = useState(false);
|
||||
const { openSnack } = useSnackbar();
|
||||
|
|
@ -96,7 +97,7 @@ export default function BinYardDrawer(props: Props) {
|
|||
settings.longitude = 0;
|
||||
settings.latitude = 0;
|
||||
binyardAPI
|
||||
.updateBinYard(yard.key, settings)
|
||||
.updateBinYard(yard.key, settings, undefined, as)
|
||||
.then(resp => {
|
||||
openSnack("Marker Removed");
|
||||
//then use the removeMarker prop function to update the markers in the parent map
|
||||
|
|
@ -138,7 +139,7 @@ export default function BinYardDrawer(props: Props) {
|
|||
let settings = yard;
|
||||
settings.theme = newTheme;
|
||||
binyardAPI
|
||||
.updateBinYard(yard.key, settings)
|
||||
.updateBinYard(yard.key, settings, undefined, as)
|
||||
.then(resp => {
|
||||
openSnack("marker settings updated");
|
||||
updateMarker(yard.key, settings);
|
||||
|
|
|
|||
|
|
@ -376,7 +376,7 @@ import { Result } from "@mapbox/mapbox-gl-geocoder";
|
|||
let yardEntries: Result[] = [];
|
||||
|
||||
binYardAPI
|
||||
.listBinYards(400, 0, "asc")
|
||||
.listBinYards(400, 0, "asc", undefined, undefined, undefined, undefined, as)
|
||||
.then(resp => {
|
||||
resp.data.yard.forEach(yard => {
|
||||
if (yard.settings) {
|
||||
|
|
@ -433,7 +433,7 @@ import { Result } from "@mapbox/mapbox-gl-geocoder";
|
|||
.catch(() => {
|
||||
openSnack("Failed to load yard data");
|
||||
});
|
||||
}, [binYardAPI, openSnack]); // eslint-disable-line react-hooks/exhaustive-deps
|
||||
}, [binYardAPI, openSnack, as]); // eslint-disable-line react-hooks/exhaustive-deps
|
||||
|
||||
const loadBins = useCallback(() => {
|
||||
binAPI
|
||||
|
|
@ -931,7 +931,7 @@ import { Result } from "@mapbox/mapbox-gl-geocoder";
|
|||
yard.longitude = long;
|
||||
yard.latitude = lat;
|
||||
binYardAPI
|
||||
.updateBinYard(yard.key, yard)
|
||||
.updateBinYard(yard.key, yard, undefined, as)
|
||||
.then(resp => {
|
||||
openSnack("BinYard Location Updated");
|
||||
if (yardOptions.includes(yard)) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue