Skip to content
This repository has been archived by the owner on Dec 13, 2024. It is now read-only.

Commit

Permalink
frontend: add register device api
Browse files Browse the repository at this point in the history
  • Loading branch information
ozfox committed Jul 1, 2024
1 parent d9d8938 commit 8ab40a4
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions frontend/src/lib/api/useDeviceApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,24 @@ class DeviceApi {
return data == undefined ? [] : data;
}

public async registerDevice(registrationCode: string, deviceName: string) {
const {data, error} = await this.withClient()
.POST("/api/v1/devices/self/register/{registrationCode}/{deviceName}", {
params: {
path: {
registrationCode: registrationCode,
deviceName: deviceName,
}
}
});

// TODO
console.log(data);
console.log(error);

return data;
}

private withClient() {
if (!this.apiClient) {
throw new Error("Client must be set.");
Expand Down

0 comments on commit 8ab40a4

Please sign in to comment.