Implementation
void onTapConfirm(BuildContext context, String username) async {
if (_isSubmitting) return;
_isSubmitting = true;
final String code = confirmController.text.trim();
if (code.isEmpty) {
EventService().eventBus.fire(PopupEvent(
type: PopupType.alert,
action: PopupAction.show,
data: {"title": "오류", "content": "코드를 입력하세요."},
onClose: () {
Navigator.of(context, rootNavigator: true).popUntil((route) => !route.settings.name!.startsWith(PopupScreen.routeName));
}));
_isSubmitting = false;
return;
}
try {
SignUpResult result = await Amplify.Auth.confirmSignUp(username: username, confirmationCode: code);
if (result.isSignUpComplete) {
EventService().eventBus.fire(PopupEvent(
type: PopupType.alert,
action: PopupAction.show,
data: {"title": "성공", "content": "계정인증에 성공했습니다. 로그인을 진행해주세요."},
onClose: () {
Navigator.of(context, rootNavigator: true).popUntil((route) => route.settings.name == SplashScreen.routeName);
Navigator.of(context, rootNavigator: true).pushNamed(SignInScreen.routeName);
}));
}
} on AuthException catch (e) {
EventService().eventBus.fire(PopupEvent(
type: PopupType.alert,
action: PopupAction.show,
data: {"title": "오류", "content": e.message},
onClose: () {
Navigator.of(context, rootNavigator: true).popUntil((route) => !route.settings.name!.startsWith(PopupScreen.routeName));
}));
}
_isSubmitting = false;
}