fixed update space

This commit is contained in:
hannathkadher
2025-01-29 11:14:12 +04:00
parent 073916d4ac
commit 4bae7bb9fb
5 changed files with 44 additions and 14 deletions

View File

@ -156,7 +156,7 @@ class CommunitySpaceManagementApi {
.replaceAll('{spaceId}', spaceId)
.replaceAll('{projectId}', TempConst.projectId),
expectedResponseModel: (json) {
return SpaceModel.fromJson(json);
return SpaceModel.fromJson(json['data']);
},
);
return response;
@ -212,7 +212,7 @@ class CommunitySpaceManagementApi {
}
}
Future<SpaceModel?> updateSpace({
Future<bool> updateSpace({
required String communityId,
required spaceId,
required String name,
@ -232,13 +232,13 @@ class CommunitySpaceManagementApi {
'y': position.dy,
'direction': direction,
'icon': icon,
'subspace':subspaces,
'tags':tags,
'subspace': subspaces,
'tags': tags,
};
if (parentId != null) {
body['parentUuid'] = parentId;
}
final response = await HTTPService().put(
path: ApiEndpoints.updateSpace
.replaceAll('{communityId}', communityId)
@ -246,13 +246,13 @@ class CommunitySpaceManagementApi {
.replaceAll('{projectId}', TempConst.projectId),
body: body,
expectedResponseModel: (json) {
return SpaceModel.fromJson(json['data']);
return json['success'] ?? false;
},
);
return response;
} catch (e) {
debugPrint('Error creating space: $e');
return null;
debugPrint('Error updating space: $e');
return false;
}
}