Implemented home management and user invitation flows

This commit is contained in:
Abdullah Alassaf
2024-06-05 03:42:00 +03:00
parent 6a9c2967d2
commit 631ba53d7a
29 changed files with 968 additions and 288 deletions
+24 -2
View File
@@ -9,8 +9,7 @@ class SpacesAPI {
static final HTTPService _httpService = HTTPService();
static Future<List<SpaceModel>> getUnitsByUserId() async {
var uuid =
await const FlutterSecureStorage().read(key: UserModel.userUuidKey);
var uuid = await const FlutterSecureStorage().read(key: UserModel.userUuidKey);
final response = await _httpService.get(
path: "${ApiEndpoints.unitUser}$uuid",
showServerMessage: false,
@@ -34,4 +33,27 @@ class SpacesAPI {
);
return response;
}
static Future<String> generateInvitationCode(
String unitId,
) async {
final response = await _httpService.get(
path: ApiEndpoints.invitationCode.replaceAll('{unitUuid}', unitId),
showServerMessage: false,
expectedResponseModel: (json) => json['invitationCode'],
);
return response;
}
static Future<bool> joinUnit(
Map<String, String> body,
) async {
final response = await _httpService.post(
path: ApiEndpoints.verifyInvitationCode,
showServerMessage: false,
body: body,
expectedResponseModel: (json) => json['success'],
);
return response;
}
}