diff --git a/src/providers/pond/deviceAPI.tsx b/src/providers/pond/deviceAPI.tsx index a7c0352..8b778d5 100644 --- a/src/providers/pond/deviceAPI.tsx +++ b/src/providers/pond/deviceAPI.tsx @@ -700,8 +700,12 @@ export default function DeviceProvider(props: PropsWithChildren) { }; const setTags = (id: number, tags: string[]) => { + const keys = getContextKeys() + const types = getContextTypes() + let url = "/devices/" + id + "/tags" + "?keys=" + keys + "&types=" + types + if (as && !keys.includes(as)) url += "&as=" + as return new Promise((resolve, reject) => { - put(pondURL("/devices/" + id + "/tags"), { tags }).then(resp => { + put(pondURL(url), { tags }).then(resp => { return resolve(resp) }).catch(err => { return reject(err) @@ -746,8 +750,12 @@ export default function DeviceProvider(props: PropsWithChildren) { }; const untag = (id: number, tag: string) => { + const keys = getContextKeys() + const types = getContextTypes() + let url = "/devices/" + id + "/tags/" + tag + "?keys=" + keys + "&types=" + types + if (as && !keys.includes(as)) url += "&as=" + as return new Promise((resolve, reject) => { - del(pondURL("/devices/" + id + "/tags/" + tag)).then(resp => { + del(pondURL(url)).then(resp => { return resolve(resp) }).catch(err => { return reject(err)