Can update device general information
This commit is contained in:
@@ -37,6 +37,12 @@ export interface Device {
|
||||
relays: DeviceRelay[];
|
||||
}
|
||||
|
||||
export interface UpdatedInfo {
|
||||
name: string;
|
||||
description: string;
|
||||
enabled: boolean;
|
||||
}
|
||||
|
||||
export function DeviceURL(d: Device): string {
|
||||
return `/dev/${encodeURIComponent(d.id)}`;
|
||||
}
|
||||
@@ -88,6 +94,17 @@ export class DeviceApi {
|
||||
).data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update a device general information
|
||||
*/
|
||||
static async Update(d: Device, info: UpdatedInfo): Promise<void> {
|
||||
await APIClient.exec({
|
||||
uri: `/device/${encodeURIComponent(d.id)}`,
|
||||
method: "PATCH",
|
||||
jsonData: info,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a device
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user