Implement milestone 2 route navigation
This commit is contained in:
@@ -1,29 +1,8 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.AspNetCore.WebUtilities;
|
||||
|
||||
namespace RpgRoller.Components.Pages;
|
||||
|
||||
[ExcludeFromCodeCoverage]
|
||||
public partial class PlayPage
|
||||
{
|
||||
private Task OnLoggedOutAsync(string? message)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(message))
|
||||
{
|
||||
Navigation.NavigateTo("/login", forceLoad: true);
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
var query = new Dictionary<string, string?>
|
||||
{
|
||||
["message"] = message,
|
||||
["kind"] = message.Contains("expired", StringComparison.OrdinalIgnoreCase) ? "error" : "success"
|
||||
};
|
||||
|
||||
Navigation.NavigateTo(QueryHelpers.AddQueryString("/login", query), forceLoad: true);
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
[Inject] private NavigationManager Navigation { get; set; } = null!;
|
||||
}
|
||||
Reference in New Issue
Block a user