mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2026-10-25 19:57:55 +00:00
Implemented home management and user invitation flows
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user