import 'package:driverapp/config/shared_pref_kay.dart';
import 'package:driverapp/core/model/authentication/authenticated_user.dart';
import 'package:driverapp/uitl/app_shared_preferences.dart';

import 'client/base_app_client.dart';

class BaseService {
  String error;
  bool hasError = false;
  BaseAppClient baseAppClient = BaseAppClient();
  AuthenticatedUser user;

  AppSharedPreferences sharedPref = AppSharedPreferences();

  BaseService() {
    getUser();
  }

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