Added app loaders and screen for the ui. Added identity service. Started auth screens

This commit is contained in:
Masu Baumgartner
2024-10-01 21:02:55 +02:00
parent ca1b7a84c9
commit 522d0c1471
8 changed files with 223 additions and 18 deletions

View File

@@ -0,0 +1,27 @@
using Microsoft.AspNetCore.Components;
using MoonCore.Blazor.Helpers;
using Moonlight.Client.Interfaces;
using Moonlight.Client.Services;
using Moonlight.Client.UI.Screens;
namespace Moonlight.Client.Implementations;
public class AuthenticationUiHandler : IAppLoader, IAppScreen
{
public int Priority => 0;
public Task<bool> ShouldRender(IServiceProvider serviceProvider)
{
var identityService = serviceProvider.GetRequiredService<IdentityService>();
return Task.FromResult(identityService.IsLoggedIn);
}
public RenderFragment Render() => ComponentHelper.FromType<AuthenticationScreen>();
public async Task Load(IServiceProvider serviceProvider)
{
var identityService = serviceProvider.GetRequiredService<IdentityService>();
await identityService.Check();
}
}