updated as in home marker api

This commit is contained in:
csawatzky 2025-04-21 16:05:09 -06:00
parent a99ab8b8b5
commit e8e32e1886
2 changed files with 9 additions and 7 deletions

View file

@ -7,7 +7,8 @@ import { pondURL } from "./pond";
export interface IHomeMarkerAPIContext {
addHomeMarker: (
homeMarker: pond.HomeMarkerSettings
homeMarker: pond.HomeMarkerSettings,
as?: string
) => Promise<AxiosResponse<pond.AddHomeMarkerResponse>>;
getHomeMarker: (homeMarkerID: string) => Promise<AxiosResponse<pond.HomeMarker>>;
listHomeMarkers: (
@ -23,7 +24,8 @@ export interface IHomeMarkerAPIContext {
updateHomeMarker: (
key: string,
homeMarker: pond.HomeMarkerSettings,
asRoot?: true
asRoot?: true,
as?:string
) => Promise<AxiosResponse<pond.UpdateHomeMarkerResponse>>;
}
@ -36,9 +38,9 @@ interface Props {}
export default function HomeMarkerProvider(props: PropsWithChildren<Props>) {
const { children } = props;
const { get, del, post, put } = useHTTP();
const [{ as }] = useGlobalState();
//const [{ as }] = useGlobalState();
const addHomeMarker = (homeMarker: pond.HomeMarkerSettings) => {
const addHomeMarker = (homeMarker: pond.HomeMarkerSettings, as?: string) => {
if (as) return post<pond.AddHomeMarkerResponse>(pondURL("/homeMarkers?as=" + as), homeMarker);
return post<pond.AddHomeMarkerResponse>(pondURL("/homeMarkers"), homeMarker);
};
@ -76,7 +78,7 @@ export default function HomeMarkerProvider(props: PropsWithChildren<Props>) {
);
};
const updateHomeMarker = (key: string, hm: pond.HomeMarkerSettings, asRoot?: boolean) => {
const updateHomeMarker = (key: string, hm: pond.HomeMarkerSettings, asRoot?: boolean, as?: string) => {
if (as)
return put<pond.UpdateHomeMarkerResponse>(
pondURL(