mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-09 22:57:21 +00:00
merged with dev and access_bugs and solved conflicts
This commit is contained in:
@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user