This repository was archived by the owner on Dec 17, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +45
-46
lines changed Expand file tree Collapse file tree 3 files changed +45
-46
lines changed Original file line number Diff line number Diff line change 11/// Update these values
22class AppConfig {
33 static const String backendUrl = 'https://4be6-71-211-245-221.ngrok-free.app' ;
4- static const String powersyncUrl = 'https://65663910ce6b81ac131b8c62.powersync.journeyapps.com' ;
4+ static const String powersyncUrl =
5+ 'https://65663910ce6b81ac131b8c62.powersync.journeyapps.com' ;
56}
Original file line number Diff line number Diff line change @@ -29,35 +29,33 @@ class _LoginPageState extends State<LoginPage> {
2929 _busy = true ;
3030 _error = null ;
3131 });
32- try {
33- final credential = await FirebaseAuth .instance.signInWithEmailAndPassword (
34- email: _usernameController.text,
35- password: _passwordController.text
36- );
37- if (mounted) {
32+ try {
33+ await FirebaseAuth .instance.signInWithEmailAndPassword (
34+ email: _usernameController.text, password: _passwordController.text);
35+ if (context.mounted) {
3836 Navigator .of (context).pushReplacement (MaterialPageRoute (
3937 builder: (context) => listsPage,
4038 ));
41- }
42- } on FirebaseAuthException catch (e) {
43- if (e.code == 'user-not-found' ) {
44- setState (() {
45- _error = 'No user found for that email.' ;
46- });
47- } else if (e.code == 'wrong-password' ) {
39+ }
40+ } on FirebaseAuthException catch (e) {
41+ if (e.code == 'user-not-found' ) {
4842 setState (() {
49- _error = 'Wrong password provided for that user .' ;
43+ _error = 'No user found for that email .' ;
5044 });
51- }
52- } catch (e) {
45+ } else if (e.code == 'wrong-password' ) {
46+ setState (() {
47+ _error = 'Wrong password provided for that user.' ;
48+ });
49+ }
50+ } catch (e) {
5351 setState (() {
5452 _error = e.toString ();
5553 });
56- } finally {
57- setState (() {
58- _busy = false ;
59- });
60- }
54+ } finally {
55+ setState (() {
56+ _busy = false ;
57+ });
58+ }
6159 }
6260
6361 @override
Original file line number Diff line number Diff line change @@ -29,35 +29,35 @@ class _SignupPageState extends State<SignupPage> {
2929 _busy = true ;
3030 _error = null ;
3131 });
32- try {
33- final credential = await FirebaseAuth .instance.createUserWithEmailAndPassword (
34- email: _usernameController.text,
35- password: _passwordController.text,
36- );
37- if ( mounted) {
32+ try {
33+ await FirebaseAuth .instance.createUserWithEmailAndPassword (
34+ email: _usernameController.text,
35+ password: _passwordController.text,
36+ );
37+ if (context. mounted) {
3838 Navigator .of (context).pushReplacement (MaterialPageRoute (
39- builder: (context) => homePage,
39+ builder: (context) => homePage,
4040 ));
41- }
42- } on FirebaseAuthException catch (e) {
43- if (e.code == 'weak-password' ) {
44- setState (() {
45- _error = 'The password provided is too weak.' ;
46- });
47- } else if (e.code == 'email-already-in-use' ) {
41+ }
42+ } on FirebaseAuthException catch (e) {
43+ if (e.code == 'weak-password' ) {
4844 setState (() {
49- _error = 'The account already exists for that email .' ;
45+ _error = 'The password provided is too weak .' ;
5046 });
51- }
52- } catch (e) {
53- setState (() {
54- _error = e.toString ();
55- });
56- } finally {
57- setState (() {
47+ } else if (e.code == 'email-already-in-use' ) {
48+ setState (() {
49+ _error = 'The account already exists for that email.' ;
50+ });
51+ }
52+ } catch (e) {
53+ setState (() {
54+ _error = e.toString ();
55+ });
56+ } finally {
57+ setState (() {
5858 _busy = false ;
59- });
60- }
59+ });
60+ }
6161 }
6262
6363 @override
You can’t perform that action at this time.
0 commit comments