login service by localstorg

This commit is contained in:
mmrbnjd
2024-04-18 18:26:12 +03:30
parent fa5a83d8d3
commit 77e004d090
11 changed files with 241 additions and 58 deletions

View File

@@ -3,12 +3,17 @@ using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
using Front;
using System.Globalization;
using Shared.DTOs;
using Front.Services;
using System.ComponentModel.Design;
var builder = WebAssemblyHostBuilder.CreateDefault(args);
builder.RootComponents.Add<App>("#app");
builder.RootComponents.Add<HeadOutlet>("head::after");
builder.Services.AddBlazorBootstrap();
builder.Services.AddScoped<UserAuthenticationDTO>();
builder.Services.AddScoped<ILocalStorageService, LocalStorageService>();
builder.Services.AddScoped<localService>();
builder.Services.AddScoped(sp => new UserAuthenticationDTO());
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri("https://localhost:7075/api/") });
@@ -17,5 +22,14 @@ builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri("https:/
CultureInfo.DefaultThreadCurrentCulture = new CultureInfo("fa-Ir");
await builder.Build().RunAsync();
var host = builder.Build();
await new MidLevel(
host.Services.GetRequiredService<ILocalStorageService>(),
host.Services.GetRequiredService<UserAuthenticationDTO>(),
host.Services.GetRequiredService<HttpClient>()
).InitAsync();
await host.RunAsync();