@page "/admin/blog/create" @attribute [Authorize] @using TaxBaik.Application.DTOs @using TaxBaik.Web.Components.Admin.Pages.Blog @inject IBlogBrowserClient BlogClient @inject ICategoryBrowserClient CategoryClient @inject NavigationManager Navigation @inject ISnackbar Snackbar 새 포스트 작성 Content 새 포스트 작성 새로운 블로그 포스트를 작성합니다. 취소 @code { private IReadOnlyList categories = []; private BlogForm.BlogFormModel model = new(); protected override async Task OnInitializedAsync() { categories = await CategoryClient.GetAllAsync(); } private void GoBack() { Navigation.NavigateTo("/taxbaik/admin/blog"); } private async Task SavePost() { try { var result = await BlogClient.CreateAsync(new CreateBlogPostDto { Title = model.Title, Content = model.Content, CategoryId = model.CategoryId, Tags = model.Tags, SeoTitle = model.SeoTitle, SeoDescription = model.SeoDescription, IsPublished = model.IsPublished }); if (result == null) { Snackbar.Add("포스트 저장에 실패했습니다.", Severity.Error); return; } Snackbar.Add("포스트가 저장되었습니다.", Severity.Success); Navigation.NavigateTo("/taxbaik/admin/blog"); } catch (ValidationException ex) { Snackbar.Add(ex.Message, Severity.Error); } } }