public async Task <ActionResult <DictRto> > TestCallRpcService() { var jwtToken = await _contextAccessor.HttpContext.GetTokenAsync("access_token"); if (jwtToken == null) { var authRpcResult = await _authRpcServcie.LoginAsync(new LoginRto { Account = "alpha2008", Password = "******" }); if (authRpcResult.IsSuccessStatusCode) { jwtToken = authRpcResult.Content.Token; } return(NotFound()); } var dictRpcResult = await _maintRpcServcie.GetDictAsync(29); if (dictRpcResult.IsSuccessStatusCode) { return(dictRpcResult.Content); } var apiError = ((Refit.ValidationApiException)dictRpcResult.Error).Content; return(Problem(apiError.Detail, dictRpcResult.Error.Uri.ToString(), apiError.Status, apiError.Title, apiError.Type)); }
public async Task <IActionResult> Login([FromBody] LoginRto loginRequest) { var result = await _authRpcService.LoginAsync(loginRequest); if (result.IsSuccessStatusCode) { return(Ok(result.Content)); } var apiError = ((Refit.ValidationApiException)result.Error).Content; return(Problem(apiError.Detail, result.Error.Uri.ToString(), apiError.Status, apiError.Title, apiError.Type)); }