import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart';
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';

class AuthenticatedUserObject{
  AuthenticatedUser user;
  AppSharedPreferences sharedPref = AppSharedPreferences();
  bool isLogin = false;
  AuthenticatedUserObject(){
    getUser();
  }

  getUser() async {
    if (user==null) {
      var userData = await sharedPref.getObject(USER_PROFILE);
      if (userData != null) user = AuthenticatedUser.fromJson(userData);
    }

    var isLogin = await sharedPref.getString(LOGIN_TOKEN_ID);
    this.isLogin = isLogin != null;
  }

}
