optionCreateAuthenticate method

Future<Response> optionCreateAuthenticate()

Creates and authenticates a user

Implementation

Future<Response> optionCreateAuthenticate() async {
  clear();
  print('Create and authenticate:');
  try {
    askName();
    askEmail();
    askPassword();

    var response = await _userUC.createAuthenticate(_name, _email, _password);

    if (response.statusCode == 400) {
      _response = 'response: ${response.statusCode}';
    } else {
      _response = 'response: ${response.body}';
      _jwt = jsonDecode(response.body)['token'];
    }
    return response;
  } catch (e) {
    _response = e.toString();
    throw ('createUser');
  }
}