Add: get token from api

This commit is contained in:
2024-05-22 00:41:44 +03:00
parent e95fb08e31
commit d8e68f9b34
3 changed files with 83 additions and 12 deletions

View File

@@ -6,6 +6,8 @@ class GymLinkProvider with ChangeNotifier {
bool get isLoading => _isLoading;
bool _blackTheme = false;
bool get blackTheme => _blackTheme;
String _token = '';
String get token => _token;
ThemeData _theme = myTheme;
ThemeData get theme => _theme;
void Function() _onError = () => {};
@@ -13,13 +15,16 @@ class GymLinkProvider with ChangeNotifier {
void Function() get onError => _onError;
void onTokenReceived(String token) {
if (token == 'token123') {
_isLoading = false;
notifyListeners();
} else {
_isLoading = true;
notifyListeners();
}
_token = token;
_isLoading = false;
notifyListeners();
// if (token == 'token123') {
// _isLoading = false;
// notifyListeners();
// } else {
// _isLoading = true;
// notifyListeners();
// }
}
void changeTheme(int color) {