create visitor password

This commit is contained in:
mohammad
2024-08-19 09:49:58 +03:00
parent 869a10f92c
commit 753aa29a8a
3 changed files with 60 additions and 21 deletions

View File

@ -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 {