fix: erro de categoria e falta de uma pagina de erro.
This commit is contained in:
parent
46afbb22cd
commit
2d901708b8
@ -36,22 +36,17 @@ public class HomeController : Controller
|
|||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
[Route("categoria/{categorySlug}")]
|
[Route("health")]
|
||||||
public async Task<IActionResult> Category(string categorySlug)
|
public IActionResult Health()
|
||||||
{
|
{
|
||||||
ViewBag.IsHomePage = true;
|
return Ok(new {
|
||||||
var category = await _categoryService.GetCategoryBySlugAsync(categorySlug);
|
status = "healthy",
|
||||||
if (category == null)
|
timestamp = DateTime.UtcNow,
|
||||||
return NotFound();
|
version = "1.0.0"
|
||||||
|
});
|
||||||
var pages = await _userPageService.GetPagesByCategoryAsync(categorySlug, 20);
|
|
||||||
|
|
||||||
ViewBag.Category = category;
|
|
||||||
ViewBag.Pages = pages;
|
|
||||||
|
|
||||||
return View();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
|
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
|
||||||
public IActionResult Error()
|
public IActionResult Error()
|
||||||
{
|
{
|
||||||
|
|||||||
26
src/BCards.Web/Views/Shared/Error.cshtml
Normal file
26
src/BCards.Web/Views/Shared/Error.cshtml
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
@{
|
||||||
|
ViewData["Title"] = "Erro";
|
||||||
|
}
|
||||||
|
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
<title>Erro - BCards</title>
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="container mt-5">
|
||||||
|
<div class="row justify-content-center">
|
||||||
|
<div class="col-md-8">
|
||||||
|
<div class="alert alert-danger">
|
||||||
|
<h4>Oops! Algo deu errado.</h4>
|
||||||
|
<p>Ocorreu um erro inesperado. Por favor, tente novamente.</p>
|
||||||
|
<a href="/" class="btn btn-primary">Voltar ao Início</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
Loading…
Reference in New Issue
Block a user