login method
Implementation
Future<bool> login({Account? account}) async {
if (account != null) {
_account = account;
}
if (_account == null) {
return false;
}
var req =
LoginRequest(email: _account!.email, password: _account!.password);
dio.Response<String> res =
await _client.post("/login", data: serializeRequest(req));
var resp = getResponse(res);
isLogin = resp.statusCode == StatusCode.Ok;
if (isLogin) {
var safeAccount = SafeAccount()
..mergeFromProto3Json(jsonDecode(resp.data));
updateAccountInfo(_account!, safeAccount);
}
return isLogin;
}