add asset validation

This commit is contained in:
hannathkadher
2025-01-09 16:18:19 +04:00
parent 097e70b906
commit 67516817ec
3 changed files with 36 additions and 14 deletions

View File

@ -19,23 +19,26 @@ class CommunitySpaceManagementApi {
.replaceAll('{projectId}', TempConst.projectId),
queryParameters: {'page': page},
expectedResponseModel: (json) {
List<dynamic> jsonData = json['data'];
hasNext = json['hasNext'] ?? false;
int currentPage = json['page'] ?? 1;
List<CommunityModel> communityList = jsonData.map((jsonItem) {
return CommunityModel.fromJson(jsonItem);
}).toList();
allCommunities.addAll(communityList);
page = currentPage + 1;
return communityList;
try {
List<dynamic> jsonData = json['data'] ?? [];
hasNext = json['hasNext'] ?? false;
int currentPage = json['page'] ?? 1;
List<CommunityModel> communityList = jsonData.map((jsonItem) {
return CommunityModel.fromJson(jsonItem);
}).toList();
allCommunities.addAll(communityList);
page = currentPage + 1;
return communityList;
} catch (_) {
hasNext = false;
return [];
}
},
);
}
return allCommunities;
} catch (e) {
debugPrint('Error fetching communities: $e');
return [];
}
}