feat(master/manager/device): Enhance device management with new detail view, API updates, and improved request handling

This commit is contained in:
Tran Anh Tuan
2026-01-27 12:18:28 +07:00
parent a11e2c2991
commit 6d1c085ff7
20 changed files with 516 additions and 20 deletions

View File

@@ -1,5 +1,5 @@
import {
API_SHARE_THING,
API_THING,
API_THING_POLICY,
API_THINGS_SEARCH,
} from '@/constants/api';
@@ -55,7 +55,7 @@ export async function apiSearchThings(
export async function apiUpdateThing(value: MasterModel.Thing) {
if (!value.id) throw new Error('Thing id is required');
return request<MasterModel.Thing>(`${API_SHARE_THING}/${value.id}`, {
return request<MasterModel.Thing>(`${API_THING}/${value.id}`, {
method: 'PUT',
data: value,
});
@@ -77,7 +77,7 @@ export async function apiDeleteUserThingPolicy(
thing_id: string,
user_id: string,
) {
return request(`${API_SHARE_THING}/${thing_id}/share`, {
return request(`${API_THING}/${thing_id}/share`, {
method: 'DELETE',
data: {
policies: ['read', 'write', 'delete'],
@@ -91,7 +91,7 @@ export async function apiShareThingToUser(
user_id: string,
policies: string[],
) {
return request(`${API_SHARE_THING}/${thing_id}/share`, {
return request(`${API_THING}/${thing_id}/share`, {
method: 'POST',
data: {
policies: policies,
@@ -100,3 +100,7 @@ export async function apiShareThingToUser(
getResponse: true,
});
}
export async function apiGetThingDetail(thing_id: string) {
return request<MasterModel.Thing>(`${API_THING}/${thing_id}`);
}