Display basic device information

This commit is contained in:
2024-07-18 20:06:46 +02:00
parent 7be81fe0e9
commit 1ce9ca3321
5 changed files with 135 additions and 3 deletions

View File

@ -37,8 +37,8 @@ export interface Device {
relays: DeviceRelay[];
}
export function DeviceURL(d: Device, edit: boolean = false): string {
return `/dev/${d.id}${edit ? "/edit" : ""}`;
export function DeviceURL(d: Device): string {
return `/dev/${encodeURIComponent(d.id)}`;
}
export class DeviceApi {
@ -76,6 +76,18 @@ export class DeviceApi {
});
}
/**
* Get the information about a single device
*/
static async GetSingle(id: string): Promise<Device> {
return (
await APIClient.exec({
uri: `/device/${encodeURIComponent(id)}`,
method: "GET",
})
).data;
}
/**
* Delete a device
*/