mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-09 22:57:21 +00:00
create visitor password
This commit is contained in:
@ -79,20 +79,37 @@ class AuthenticationAPI {
|
||||
}
|
||||
}
|
||||
|
||||
static Future<bool> verifyOtp(
|
||||
static Future verifyOtp(
|
||||
{required String email, required String otpCode}) async {
|
||||
final response = await HTTPService().post(
|
||||
path: ApiEndpoints.verifyOtp,
|
||||
body: {"email": email, "type": "PASSWORD", "otpCode": otpCode},
|
||||
showServerMessage: true,
|
||||
expectedResponseModel: (json) {
|
||||
if (json['message'] == 'Otp Verified Successfully') {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
return response;
|
||||
try{
|
||||
final response = await HTTPService().post(
|
||||
path: ApiEndpoints.verifyOtp,
|
||||
body: {"email": email, "type": "PASSWORD", "otpCode": otpCode},
|
||||
showServerMessage: true,
|
||||
expectedResponseModel: (json) {
|
||||
print('json=$json');
|
||||
|
||||
if (json['message'] == 'Otp Verified Successfully') {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
return response;
|
||||
}on DioException catch (e){
|
||||
if (e.response != null) {
|
||||
if (e.response!.statusCode == 400) {
|
||||
// Handle 400 Bad Request
|
||||
final errorData = e.response!.data;
|
||||
String errorMessage = errorData['message'];
|
||||
debugPrint('Unexpected Error: $errorMessage');
|
||||
return errorMessage;
|
||||
|
||||
}
|
||||
} else {
|
||||
debugPrint('Error: ${e.message}');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static Future<List<RegionModel>> fetchRegion() async {
|
||||
|
Reference in New Issue
Block a user