mirror of
https://github.com/SyncrowIOT/web.git
synced 2026-10-24 22:47:57 +00:00
curtain and forget password and select all check box and fix bugs
This commit is contained in:
@@ -29,40 +29,13 @@ class AuthenticationAPI {
|
||||
}
|
||||
|
||||
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 json['data']['cooldown'];
|
||||
});
|
||||
return response;
|
||||
} on DioException catch (e) {
|
||||
final errorData = e.response!.data;
|
||||
String errorMessage = errorData['message'];
|
||||
print('sendOtp=$errorMessage');
|
||||
if (e.response != null) {
|
||||
if (e.response!.statusCode == 400) {
|
||||
final errorData = e.response!.data;
|
||||
String errorMessage = errorData['message'];
|
||||
print('sendOtp=$errorMessage');
|
||||
|
||||
if (errorMessage == 'User not found') {
|
||||
return 1;
|
||||
} else {
|
||||
int cooldown = errorData['data']['cooldown'] ?? 1;
|
||||
return cooldown;
|
||||
}
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
} catch (e) {
|
||||
return 1;
|
||||
}
|
||||
final response = await HTTPService().post(
|
||||
path: ApiEndpoints.sendOtp,
|
||||
body: {"email": email, "type": "PASSWORD", "regionUuid": regionUuid},
|
||||
showServerMessage: true,
|
||||
expectedResponseModel: (json) {
|
||||
return json['data']['cooldown'];
|
||||
});
|
||||
}
|
||||
|
||||
static Future verifyOtp({required String email, required String otpCode}) async {
|
||||
|
||||
@@ -33,6 +33,7 @@ class DevicesManagementApi {
|
||||
path: ApiEndpoints.getDeviceStatus.replaceAll('{uuid}', uuid),
|
||||
showServerMessage: true,
|
||||
expectedResponseModel: (json) {
|
||||
print('getDeviceStatus$json');
|
||||
return DeviceStatus.fromJson(json);
|
||||
},
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user