FrappeAuthController constructor

FrappeAuthController(
  1. RenovationConfig config, {
  2. FrappeSessionStatusInfo? sessionStatusInfo,
})

If sessionStatusInfo is not null, the session and the token will be set locally.

This can be useful, if the session was stored in "SharedPreferences", for instance where the controller can be initialized with a previous session.

Implementation

FrappeAuthController(RenovationConfig config,
    {FrappeSessionStatusInfo? sessionStatusInfo})
    : super(config, sessionStatusInfo: sessionStatusInfo) {
  if (sessionStatusInfo != null) {
    updateSession(
        sessionStatus: sessionStatusInfo,
        loggedIn: sessionStatusInfo.loggedIn == true,
        useTimestamp: sessionStatusInfo.timestamp);

    if (sessionStatusInfo.token != null) {
      setAuthToken(sessionStatusInfo.token);
    }
  }
}