This commit is contained in:
Patrick Alvin Alcala 2025-02-17 14:49:06 +08:00
parent 3aa12bfcad
commit 71a289b74c
11 changed files with 108 additions and 52 deletions

View file

@ -31,8 +31,6 @@ class _RegisterPageState extends State<RegisterPage> {
final password = _passwordController.text;
final confirmPassword = _confirmPasswordController.text;
setState(() => _isLoading = true);
if (email.isEmpty) {
if (mounted) {
showNotification(context, 'Error: Please enter a valid email', false);
@ -59,9 +57,21 @@ class _RegisterPageState extends State<RegisterPage> {
return;
}
setState(() => _isLoading = true);
try {
if (await InternetConnectionChecker.instance.hasConnection) {
await _authService.signUp(email, password);
if (mounted) {
showNotification(context, 'Registration Successful', true);
WidgetsBinding.instance.addPostFrameCallback((_) {
if (mounted) {
context.push('/login');
}
});
}
} else {
if (mounted) {
showNotification(context, 'Error: No Internet Connection', false);