Line data Source code
1 : import 'package:redux/redux.dart';
2 :
3 : import '../../../actions.dart';
4 : import '../../../types.dart';
5 : import '../../redux/extensions/store_extensions.dart';
6 : import '../../utils/red_fire_locator.dart';
7 : import '../actions/email/sign_up_with_email_action.dart';
8 :
9 : class SignUpWithEmailMiddleware<T extends RedFireState>
10 : extends TypedMiddleware<T, SignUpWithEmailAction> {
11 0 : SignUpWithEmailMiddleware()
12 0 : : super((store, action, next) async {
13 0 : next(action);
14 :
15 : try {
16 0 : final service = RedFireLocator.getAuthService();
17 :
18 0 : var email = store.state.auth.emailVM.email!;
19 :
20 0 : store.dispatch(
21 : const SetAuthStepAction(AuthStepEnum.signingInWithFirebase));
22 :
23 0 : await service.signUpWithEmailAndPassword(email, action.password);
24 :
25 0 : store.dispatch(
26 : const SetAuthStepAction(AuthStepEnum.waitingForInput));
27 : } catch (error, trace) {
28 0 : store.dispatchProblem(error, trace);
29 : }
30 : });
31 : }
|