applyAuthEffect top-level property
Implementation
final applyAuthEffect = when<ApplyAuthFormSubmitted>((event) async {
final phoneNumber = event.phoneNumber;
final response = await withRetry(withPostLog(post))(
endpoint("auth/apply"),
body: jsonEncode({
"phoneNumber": phoneNumber,
}),
);
switch (response.state) {
case ResterResponseState.success:
final id = response.json["id"];
final sign = response.json["sign"];
dispatch(ApplyAuthFormResolved(
id: id,
phoneNumber: phoneNumber,
sign: sign,
));
break;
case ResterResponseState.failure:
dispatch(ApplyAuthFormRejected(response.message));
break;
}
});