make one API with new QP to filter on spacesId

This commit is contained in:
Rafeek-Khoudare
2025-06-29 09:17:22 +03:00
parent 479aa4a091
commit bd53388438
4 changed files with 51 additions and 58 deletions

View File

@ -13,15 +13,13 @@ import 'package:syncrow_web/utils/constants/api_const.dart';
class DevicesManagementApi {
Future<List<AllDevicesModel>> fetchDevices(
String communityId, String spaceId, String projectId) async {
String projectId, {
List<String>? spacesId,
}) async {
try {
final response = await HTTPService().get(
path: communityId.isNotEmpty && spaceId.isNotEmpty
? ApiEndpoints.getSpaceDevices
.replaceAll('{spaceUuid}', spaceId)
.replaceAll('{communityUuid}', communityId)
.replaceAll('{projectId}', projectId)
: ApiEndpoints.getAllDevices.replaceAll('{projectId}', projectId),
queryParameters: {if (spacesId != null) 'spaces': spacesId},
path: ApiEndpoints.getAllDevices.replaceAll('{projectId}', projectId),
showServerMessage: true,
expectedResponseModel: (json) {
List<dynamic> jsonData = json['data'];
@ -416,5 +414,4 @@ class DevicesManagementApi {
);
return response;
}
}