mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-10 07:07:19 +00:00
fixes checkEmail error
This commit is contained in:
@ -76,7 +76,9 @@ class UserPermissionApi {
|
||||
}
|
||||
}
|
||||
|
||||
Future<String?> checkEmail(email) async {
|
||||
|
||||
|
||||
Future<String?> checkEmail(String email) async {
|
||||
try {
|
||||
final response = await _httpService.post(
|
||||
path: ApiEndpoints.checkEmail,
|
||||
@ -84,16 +86,26 @@ class UserPermissionApi {
|
||||
body: {"email": email},
|
||||
expectedResponseModel: (json) {
|
||||
if (json['statusCode'] != 400) {
|
||||
return json["message"];
|
||||
var message = json["message"];
|
||||
if (message is String) {
|
||||
return message;
|
||||
} else {
|
||||
return 'Unexpected message format';
|
||||
}
|
||||
}
|
||||
return null;
|
||||
},
|
||||
);
|
||||
return response ?? [];
|
||||
return response ?? 'Unknown error occurred';
|
||||
} on DioException catch (e) {
|
||||
if (e.response != null) {
|
||||
print(e.response?.data['error']);
|
||||
final errorMessage = e.response?.data['error'];
|
||||
return errorMessage;
|
||||
return errorMessage is String
|
||||
? errorMessage
|
||||
: 'Error occurred while checking email';
|
||||
}
|
||||
return 'Error occurred while checking email';
|
||||
} catch (e) {
|
||||
return e.toString();
|
||||
}
|
||||
|
Reference in New Issue
Block a user