fix(auth): set failure status on sendCodeSilently error
This commit is contained in:
@@ -153,7 +153,15 @@ class RegisterCubit extends Cubit<RegisterState> {
|
||||
}
|
||||
|
||||
Future<bool> resendCode() async {
|
||||
if (state.pendingEmail == null) return false;
|
||||
if (state.pendingEmail == null) {
|
||||
emit(
|
||||
state.copyWith(
|
||||
status: FormzSubmissionStatus.failure,
|
||||
errorMessage: '验证码发送失败,请返回上一步重试',
|
||||
),
|
||||
);
|
||||
return false;
|
||||
}
|
||||
|
||||
emit(state.copyWith(status: FormzSubmissionStatus.inProgress));
|
||||
|
||||
@@ -200,7 +208,13 @@ class RegisterCubit extends Cubit<RegisterState> {
|
||||
);
|
||||
} catch (e) {
|
||||
final message = e is ApiException ? e.message : '验证码发送失败,请重试';
|
||||
emit(state.copyWith(isSending: false, errorMessage: message));
|
||||
emit(
|
||||
state.copyWith(
|
||||
isSending: false,
|
||||
status: FormzSubmissionStatus.failure,
|
||||
errorMessage: message,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user