Login Repo
This commit is contained in:
@@ -111,4 +111,28 @@ class AuthRepository implements IAuthRepository {
|
||||
return left(const AuthFailure.unexpectedError());
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Future<Either<AuthFailure, Login>> login({
|
||||
required String phoneNumber,
|
||||
required String password,
|
||||
}) async {
|
||||
try {
|
||||
final result = await _remoteDataProvider.login(
|
||||
phoneNumber: phoneNumber,
|
||||
password: password,
|
||||
);
|
||||
|
||||
if (result.hasError) {
|
||||
return left(result.error!);
|
||||
}
|
||||
|
||||
final auth = result.data!.toDomain();
|
||||
|
||||
return right(auth);
|
||||
} catch (e, s) {
|
||||
log('loginError', name: _logName, error: e, stackTrace: s);
|
||||
return left(const AuthFailure.unexpectedError());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user