-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #146 from PDG-NUTRI/145-fix-guards
145 fix guards
- Loading branch information
Showing
9 changed files
with
44 additions
and
33 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,17 @@ class AuthProvider extends ChangeNotifier { | |
: _auth = auth, | ||
_userApi = clientApi; | ||
|
||
Future<void> init() async { | ||
if (isConnected()) { | ||
final values = await Future.wait([ | ||
fetchClient(), | ||
_auth.isDietitian(), | ||
]); | ||
|
||
_isAdmin = values[1] as bool; | ||
} | ||
} | ||
|
||
bool get isAdmin => _isAdmin; | ||
|
||
User? get user => _client; | ||
|
@@ -28,12 +39,12 @@ class AuthProvider extends ChangeNotifier { | |
} | ||
|
||
Future<void> signIn(String email, String password) async { | ||
//final isConnected = await _auth.signIn(email: email, password: password); | ||
final isConnected = | ||
await _auth.signIn(email: "[email protected]", password: 'crepes'); | ||
final isConnected = await _auth.signIn(email: email, password: password); | ||
//final isConnected = | ||
//await _auth.signIn(email: "[email protected]", password: 'crepes'); | ||
_isAdmin = await _auth.isDietitian(); | ||
if (isConnected) { | ||
fetchClient(); | ||
await fetchClient(); | ||
} | ||
|
||
notifyListeners(); | ||
|
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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