detach tag is now properly using context
This commit is contained in:
parent
312cc6e2dc
commit
07b0e6c41e
1 changed files with 10 additions and 2 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue