console error is ERR_CONNECTION_REFUSED and Uncaught (in promise) AxiosError {message: 'Network Error', name: 'AxiosError', code: 'ERR_NETWORK' ~
controller
[ApiController]
[Route("api/[controller]")]
public class AccountController : ControllerBase
{
private readonly IHaruUserRepository _repository;
private readonly ILogger _logger;
public AccountController(IHaruUserRepository repository, ILoggerFactory loggerFactory)
{
this._repository = repository ?? throw new ArgumentNullException(nameof(AccountController));
this._logger = loggerFactory.CreateLogger(nameof(AccountController));
}
[HttpGet] // [HttpGet("[action]")]
public async Task<IActionResult> GetAll()
{
try
{
var models = await _repository.GetAllAsync();
if (!models.Any())
{
return new NoContentResult();
}
return Ok(models);
}
catch (Exception e)
{
_logger.LogError(e.Message);
return BadRequest();
}
}
function
async handleSubmit(e) {
e.preventDefault();
await axios.get("/api/account").then(result => {
});
}
