fix: send machineId when calling admin device APIs
This commit is contained in:
parent
16ed53e24a
commit
a76c6724f1
1 changed files with 7 additions and 7 deletions
|
|
@ -3111,7 +3111,7 @@ export function DeviceDetails({ device }: DeviceDetailsProps) {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: { "Content-Type": "application/json" },
|
headers: { "Content-Type": "application/json" },
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
deviceId: device.id,
|
machineId: device.id,
|
||||||
persona: accessRole,
|
persona: accessRole,
|
||||||
email: accessEmail.trim(),
|
email: accessEmail.trim(),
|
||||||
name: accessName.trim() || undefined,
|
name: accessName.trim() || undefined,
|
||||||
|
|
@ -3292,7 +3292,7 @@ export function DeviceDetails({ device }: DeviceDetailsProps) {
|
||||||
const response = await fetch("/api/admin/devices/toggle-active", {
|
const response = await fetch("/api/admin/devices/toggle-active", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: { "Content-Type": "application/json" },
|
headers: { "Content-Type": "application/json" },
|
||||||
body: JSON.stringify({ deviceId: device.id, active: nextActive }),
|
body: JSON.stringify({ machineId: device.id, active: nextActive }),
|
||||||
credentials: "include",
|
credentials: "include",
|
||||||
})
|
})
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
|
|
@ -3319,7 +3319,7 @@ export function DeviceDetails({ device }: DeviceDetailsProps) {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: { "Content-Type": "application/json" },
|
headers: { "Content-Type": "application/json" },
|
||||||
credentials: "include",
|
credentials: "include",
|
||||||
body: JSON.stringify({ deviceId: device.id }),
|
body: JSON.stringify({ machineId: device.id }),
|
||||||
})
|
})
|
||||||
const payload = (await response.json().catch(() => null)) as { error?: string; revoked?: number } | null
|
const payload = (await response.json().catch(() => null)) as { error?: string; revoked?: number } | null
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
|
|
@ -4019,7 +4019,7 @@ export function DeviceDetails({ device }: DeviceDetailsProps) {
|
||||||
className="border-rose-200 text-rose-600 hover:bg-rose-50 hover:text-rose-700"
|
className="border-rose-200 text-rose-600 hover:bg-rose-50 hover:text-rose-700"
|
||||||
onClick={async () => {
|
onClick={async () => {
|
||||||
try {
|
try {
|
||||||
const res = await fetch(`/api/admin/devices/links?deviceId=${device.id}&userId=${u.id}`, { method: 'DELETE', credentials: 'include' })
|
const res = await fetch(`/api/admin/devices/links?machineId=${device.id}&userId=${u.id}`, { method: 'DELETE', credentials: 'include' })
|
||||||
if (!res.ok) throw new Error('HTTP ' + res.status)
|
if (!res.ok) throw new Error('HTTP ' + res.status)
|
||||||
toast.success('Vínculo removido')
|
toast.success('Vínculo removido')
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
@ -4058,7 +4058,7 @@ export function DeviceDetails({ device }: DeviceDetailsProps) {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: { 'Content-Type': 'application/json' },
|
headers: { 'Content-Type': 'application/json' },
|
||||||
credentials: 'include',
|
credentials: 'include',
|
||||||
body: JSON.stringify({ deviceId: device.id, email: accessEmail.trim() }),
|
body: JSON.stringify({ machineId: device.id, email: accessEmail.trim() }),
|
||||||
})
|
})
|
||||||
if (!res.ok) throw new Error('HTTP ' + res.status)
|
if (!res.ok) throw new Error('HTTP ' + res.status)
|
||||||
toast.success('Usuário vinculado')
|
toast.success('Usuário vinculado')
|
||||||
|
|
@ -4099,7 +4099,7 @@ export function DeviceDetails({ device }: DeviceDetailsProps) {
|
||||||
const res = await fetch("/api/admin/devices/rename", {
|
const res = await fetch("/api/admin/devices/rename", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: { "Content-Type": "application/json" },
|
headers: { "Content-Type": "application/json" },
|
||||||
body: JSON.stringify({ deviceId: device.id, hostname: name }),
|
body: JSON.stringify({ machineId: device.id, hostname: name }),
|
||||||
})
|
})
|
||||||
if (!res.ok) throw new Error(`HTTP ${res.status}`)
|
if (!res.ok) throw new Error(`HTTP ${res.status}`)
|
||||||
toast.success("Dispositivo renomeada")
|
toast.success("Dispositivo renomeada")
|
||||||
|
|
@ -5682,7 +5682,7 @@ export function DeviceDetails({ device }: DeviceDetailsProps) {
|
||||||
const res = await fetch("/api/admin/devices/delete", {
|
const res = await fetch("/api/admin/devices/delete", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: { "Content-Type": "application/json" },
|
headers: { "Content-Type": "application/json" },
|
||||||
body: JSON.stringify({ deviceId: device.id }),
|
body: JSON.stringify({ machineId: device.id }),
|
||||||
credentials: "include",
|
credentials: "include",
|
||||||
})
|
})
|
||||||
if (!res.ok) throw new Error(`HTTP ${res.status}`)
|
if (!res.ok) throw new Error(`HTTP ${res.status}`)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue