Created
August 26, 2022 15:02
-
-
Save salihgueler/b6428295c10c10d60735145494f2837c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Future<void> _confirmUser() async { | |
try { | |
// (1) | |
final result = await Amplify.Auth.confirmSignUp( | |
username: widget.username!, | |
confirmationCode: _confirmationCodeController.text, | |
); | |
// (2) | |
setState(() { | |
_isLoading = false; | |
}); | |
// (3) | |
if (result.isSignUpComplete && mounted) { | |
context.go('/sign-in'); | |
} | |
// (4) | |
} on CodeMismatchException { | |
setState(() { | |
_isLoading = false; | |
_errorMessage = 'The confirmation code is wrong. Please enter it again.'; | |
}); | |
} on Exception catch(error) { | |
setState(() { | |
_isLoading = false; | |
_errorMessage = 'An unexpected error has happened. Check the logs for detail'; | |
}); | |
logger.error(error.toString()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment