doLoginWithId method
Implementation
Future<bool> doLoginWithId(int accountId) async {
var req = await HttpRequest().httpRequest(
HttpIntent("auth/login_with_id", {"account_id": accountId}),
"Effettuo login...",
dialog: dialog,
context: context);
if (!elaborateResponse(req)) {
return false;
}
try {
HttpRequest.userToken =
ApiToken.fromJson(req.response);
SharedPreferences.getInstance().then((value) {
value.setString("api_token", jsonEncode(HttpRequest.userToken));
});
return true;
} catch (e) {
return false;
}
}