comp
This commit is contained in:
@@ -13,6 +13,7 @@ class AuthBloc extends Bloc<AuthEvent, AuthState> {
|
||||
super(AuthStateInitial()) {
|
||||
on<AuthEventLoginOAuth>(_onAuthEventLoginOAuth);
|
||||
on<AuthEventVerifyOAuth>(_onAuthEventVerifyOAuth);
|
||||
on<AuthEventAddEmailAndPassword>(_onAuthEventAddEmailAndPassword);
|
||||
}
|
||||
|
||||
void _onAuthEventLoginOAuth(
|
||||
@@ -46,4 +47,14 @@ class AuthBloc extends Bloc<AuthEvent, AuthState> {
|
||||
emit(const AuthStateFailure());
|
||||
}
|
||||
}
|
||||
|
||||
void _onAuthEventAddEmailAndPassword(
|
||||
AuthEventAddEmailAndPassword event, Emitter<AuthState> emit) async {
|
||||
emit(AuthStateProcess());
|
||||
try {
|
||||
await _userRepository.addEmailAndPassword(event.email, event.password);
|
||||
} catch (e) {
|
||||
emit(const AuthStateFailure());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,3 +18,16 @@ class AuthEventVerifyOAuth extends AuthEvent {
|
||||
|
||||
const AuthEventVerifyOAuth({required this.code});
|
||||
}
|
||||
|
||||
class AuthEventAddEmailAndPassword extends AuthEvent {
|
||||
final String email;
|
||||
final String password;
|
||||
|
||||
const AuthEventAddEmailAndPassword({
|
||||
required this.email,
|
||||
required this.password,
|
||||
});
|
||||
|
||||
@override
|
||||
List<Object> get props => [email, password];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user