getSessionIDForSubs method

Future<SubscriptionAccess?> getSessionIDForSubs(
  1. String loginId
)

Implementation

Future<SubscriptionAccess?> getSessionIDForSubs(String loginId) async {
  var uri = Uri.parse('${APIMode.BASE_URL}api/v1/login-challenge/$loginId');

  var response = await http.get(uri);
  if (response.statusCode == 200) {
    LoginChallengeget loginChallengeget =
        loginChallengegetFromJson(response.body);

    String sessionId = loginChallengeget.sessionId.toString();
    await CoreDb.instance().setSessionId(sessionId);
    var responseDta = await getPstssForSubs();
    return responseDta;
  } else {
    onPluginError(response.body);
  }
}