feat: harden auth ops and deployment baseline
This commit is contained in:
@@ -1,27 +1,26 @@
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
using TaxBaik.Application.Services;
|
||||
using TaxBaik.Domain.Entities;
|
||||
using TaxBaik.Web.Services;
|
||||
|
||||
namespace TaxBaik.Web.Pages;
|
||||
|
||||
public class IndexModel : PageModel
|
||||
{
|
||||
private readonly IApiClient _apiClient;
|
||||
private readonly BlogService _blogService;
|
||||
|
||||
public List<BlogPost> RecentPosts { get; set; } = [];
|
||||
|
||||
public IndexModel(IApiClient apiClient)
|
||||
public IndexModel(BlogService blogService)
|
||||
{
|
||||
_apiClient = apiClient;
|
||||
_blogService = blogService;
|
||||
}
|
||||
|
||||
public async Task OnGetAsync()
|
||||
{
|
||||
try
|
||||
{
|
||||
var response = await _apiClient.GetAsync<BlogApiResponse>("blog?page=1&pageSize=3");
|
||||
if (response?.Data != null)
|
||||
RecentPosts = response.Data.ToList();
|
||||
var (posts, _) = await _blogService.GetPublishedPagedAsync(1, 3);
|
||||
RecentPosts = posts.ToList();
|
||||
}
|
||||
catch
|
||||
{
|
||||
@@ -29,11 +28,3 @@ public class IndexModel : PageModel
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class BlogApiResponse
|
||||
{
|
||||
public List<BlogPost> Data { get; set; } = [];
|
||||
public int Total { get; set; }
|
||||
public int Page { get; set; }
|
||||
public int PageSize { get; set; }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user