detach tag is now properly using context

This commit is contained in:
Carter 2026-05-22 15:57:30 -06:00
parent 312cc6e2dc
commit 07b0e6c41e

View file

@ -700,8 +700,12 @@ export default function DeviceProvider(props: PropsWithChildren<Props>) {
};
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<AxiosResponse>((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<Props>) {
};
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<AxiosResponse>((resolve, reject) => {
del(pondURL("/devices/" + id + "/tags/" + tag)).then(resp => {
del(pondURL(url)).then(resp => {
return resolve(resp)
}).catch(err => {
return reject(err)