chore: cleanup
This commit is contained in:
parent
0e725b065a
commit
f5ac34e639
17 changed files with 67 additions and 3 deletions
17
ImageBoardServerApp/Pages/Components/ReportPage.razor
Normal file
17
ImageBoardServerApp/Pages/Components/ReportPage.razor
Normal file
|
@ -0,0 +1,17 @@
|
|||
@page "/report/{type}/{board}/{id}"
|
||||
@using System.ComponentModel.DataAnnotations
|
||||
<h3>Report</h3>
|
||||
|
||||
@code {
|
||||
[Parameter]
|
||||
[Required]
|
||||
public string type { get; set; }
|
||||
|
||||
[Parameter]
|
||||
[Required]
|
||||
public string board { get; set; }
|
||||
|
||||
[Parameter]
|
||||
[Required]
|
||||
public string id { get; set; }
|
||||
}
|
44
ImageBoardServerApp/Pages/Components/ThreadPage.razor
Normal file
44
ImageBoardServerApp/Pages/Components/ThreadPage.razor
Normal file
|
@ -0,0 +1,44 @@
|
|||
@page "/{boardName}/thread/{threadId}"
|
||||
@using System.ComponentModel.DataAnnotations
|
||||
@using ImageBoardServerApp.Data.Repository
|
||||
@inject NavigationManager NavigationManager
|
||||
|
||||
<h3>Thread #@threadId on /@boardName/</h3>
|
||||
<Post post="@post" showOpenThread="false"/>
|
||||
<hr/>
|
||||
|
||||
@foreach (var comment in post.Comments)
|
||||
{
|
||||
<Comment comment="comment"/>
|
||||
<hr/>
|
||||
}
|
||||
<CommentForm post="post"/>
|
||||
|
||||
@code {
|
||||
[Parameter]
|
||||
[Required]
|
||||
public string boardName { get; set; }
|
||||
|
||||
[Parameter]
|
||||
[Required]
|
||||
public string threadId { get; set; }
|
||||
|
||||
private PostData post;
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
try
|
||||
{
|
||||
post = await PostsRepository.getPostByIdAsync(int.Parse(threadId));
|
||||
}
|
||||
catch (FormatException fe)
|
||||
{
|
||||
NavigationManager.NavigateTo("/notfound");
|
||||
return;
|
||||
}
|
||||
if(post.Board != boardName)
|
||||
NavigationManager.NavigateTo("/notfound");
|
||||
if(post == null)
|
||||
NavigationManager.NavigateTo("/notfound");
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue