Revert "Sp 1589 fe when user navigates to devices page the devices are already listed although no community is selected also when we select a community the api is being called repeatedly too many times (#305)"

This reverts commit 034a5ef908, reversing
changes made to b97183fb61.
This commit is contained in:
Rafeek-Khoudare
2025-06-29 14:45:54 +03:00
parent 6dd3329288
commit 57bd4b8527
4 changed files with 59 additions and 49 deletions

View File

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