certifyAuthEffect top-level property

Effect certifyAuthEffect
final

Implementation

final certifyAuthEffect = when<CertifyAuthFormSubmitted>((event) async {
  final response = await withRetry(withPostLog(post))(
    endpoint("auth/certify"),
    body: jsonEncode({
      "id": event.id,
      "code": event.code,
    }),
  );

  switch (response.state) {
    case ResterResponseState.success:
      await saveRefreshToken(response.json["refreshToken"]);

      dispatch(const CertifyAuthFormResolved());

      break;
    case ResterResponseState.failure:
      dispatch(CertifyAuthFormRejcted(response.message));

      break;
  }
});