merged with dev and access_bugs and solved conflicts

This commit is contained in:
Abdullah Alassaf
2024-08-28 14:50:47 +03:00
30 changed files with 1326 additions and 1207 deletions

View File

@ -29,17 +29,17 @@ class AuthenticationAPI {
return response;
}
static Future<int?> sendOtp(
{required String email, required String regionUuid}) async {
static Future<int?> sendOtp({required String email, required String regionUuid}) async {
try {
final response = await HTTPService().post(
path: ApiEndpoints.sendOtp,
body: {"email": email, "type": "PASSWORD", "regionUuid": regionUuid},
showServerMessage: true,
expectedResponseModel: (json) {
return 30;
return json['data']['cooldown'];
});
return 30;
return response;
} on DioException catch (e) {
if (e.response != null) {
if (e.response!.statusCode == 400) {
@ -52,8 +52,7 @@ class AuthenticationAPI {
return cooldown;
}
} else {
debugPrint(
'Error: ${e.response!.statusCode} - ${e.response!.statusMessage}');
debugPrint('Error: ${e.response!.statusCode} - ${e.response!.statusMessage}');
return 1;
}
} else {
@ -66,8 +65,7 @@ class AuthenticationAPI {
}
}
static Future verifyOtp(
{required String email, required String otpCode}) async {
static Future verifyOtp({required String email, required String otpCode}) async {
try {
final response = await HTTPService().post(
path: ApiEndpoints.verifyOtp,
@ -99,9 +97,7 @@ class AuthenticationAPI {
path: ApiEndpoints.getRegion,
showServerMessage: true,
expectedResponseModel: (json) {
return (json as List)
.map((zone) => RegionModel.fromJson(zone))
.toList();
return (json as List).map((zone) => RegionModel.fromJson(zone)).toList();
});
return response;
}