feat: added redirect page

fix: fixed reloading issues

Signed-off-by: limited_dev <loginakkisativ@gmail.com>
This commit is contained in:
limited_dev 2023-06-13 17:08:44 +02:00
parent 8f38879294
commit e788ddf2a3
3 changed files with 23 additions and 17 deletions

View file

@ -0,0 +1,19 @@
@page "/sys/click/red/{loc}"
@using System.ComponentModel.DataAnnotations
@inject NavigationManager navManager
<h3>Redirecting...</h3>
@code {
[Parameter]
[Required]
public string loc { get; set; }
protected override async Task OnAfterRenderAsync(bool firstRender)
{
var p = loc.Replace("_", "/");
navManager.NavigateTo(p, true, true);
await base.OnAfterRenderAsync(firstRender);
}
}

View file

@ -4,6 +4,8 @@
@using System.Text.RegularExpressions @using System.Text.RegularExpressions
@using System.ComponentModel.DataAnnotations @using System.ComponentModel.DataAnnotations
@inject AuthenticationStateProvider authStateProvider @inject AuthenticationStateProvider authStateProvider
@inject NavigationManager navigationManager;
<div class="comment"> <div class="comment">
<div class="threadHeader"> <div class="threadHeader">
<span>[</span> <span>[</span>
@ -132,6 +134,7 @@
if (foundusr.Role != "User" || comment.UserID == foundusr.UserID) if (foundusr.Role != "User" || comment.UserID == foundusr.UserID)
{ {
await TheManager.deleteComment(comment); await TheManager.deleteComment(comment);
navigationManager.NavigateTo($"/sys/click/red/_{comment.Board}_thread_{comment.PostID}");
} }
} }

View file

@ -149,22 +149,6 @@
</div> </div>
@code { @code {
/*
private RenderFragment[] RenderWithAnchorTags(string input)
{
return input.Split(' ').Select(e => e.StartsWith("https://") || e.StartsWith("http://")
? (RenderFragment)(builder =>
{
builder.OpenElement(0, "a");
builder.AddAttribute(1, "href", e);
builder.AddContent(2, e);
builder.CloseElement();
})
: (RenderFragment)(builder => builder.AddContent(0, e))).ToArray();
}
*/
private string reportURL { get; set; } private string reportURL { get; set; }
private string threadURL { get; set; } private string threadURL { get; set; }
private string openThreadName { get; set; } private string openThreadName { get; set; }
@ -203,7 +187,7 @@
if (foundusr.Role != "User" || post.UserID == foundusr.UserID) if (foundusr.Role != "User" || post.UserID == foundusr.UserID)
{ {
await TheManager.deleteThread(post); await TheManager.deleteThread(post);
navigationManager.NavigateTo($"/{boardTag}"); navigationManager.NavigateTo($"/sys/click/red/_{boardTag}");
} }
} }