feat: add device management UI in admin user card

Show connected devices in subscription tab with ability to:
- View device platform, model, HWID and connection date
- Delete individual devices
- Reset all devices at once
This commit is contained in:
Fringg
2026-02-08 20:49:07 +03:00
parent 92d206f5b6
commit 6f31fbe6b5
6 changed files with 191 additions and 2 deletions

View File

@@ -563,4 +563,33 @@ export const adminUsersApi = {
const response = await apiClient.get(`/cabinet/admin/users/${userId}/node-usage`);
return response.data;
},
// Get user devices
getUserDevices: async (
userId: number,
): Promise<{
devices: { hwid: string; platform: string; device_model: string; created_at: string | null }[];
total: number;
device_limit: number;
}> => {
const response = await apiClient.get(`/cabinet/admin/users/${userId}/devices`);
return response.data;
},
// Delete single device
deleteUserDevice: async (
userId: number,
hwid: string,
): Promise<{ success: boolean; message: string; deleted_hwid: string | null }> => {
const response = await apiClient.delete(`/cabinet/admin/users/${userId}/devices/${hwid}`);
return response.data;
},
// Reset all devices
resetUserDevices: async (
userId: number,
): Promise<{ success: boolean; message: string; deleted_count: number }> => {
const response = await apiClient.delete(`/cabinet/admin/users/${userId}/devices`);
return response.data;
},
};