MAUI-ba is jól bele lett rakva a Bearer token, ha van.
This commit is contained in:
@@ -11,6 +11,7 @@ using DevExpress.Maui;
|
||||
using Microsoft.Maui.Controls.Hosting;
|
||||
using Microsoft.Maui.Hosting;
|
||||
using CommunityToolkit.Maui.Core;
|
||||
using WorkFlowCheck.MAUI.Handlers;
|
||||
|
||||
namespace WorkFlowCheck.MAUI
|
||||
{
|
||||
@@ -35,12 +36,9 @@ namespace WorkFlowCheck.MAUI
|
||||
|
||||
var configuration = new ConfigurationBuilder().SetBasePath(FileSystem.AppDataDirectory) // A konfigurációs fájl betöltése az alkalmazás adat könyvtárából
|
||||
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true).Build();
|
||||
builder.Services.AddHttpClient<UserService>(client =>
|
||||
{
|
||||
var apiUrl = configuration["ApiBaseUrl"]; // API-cím betöltése a konfigurációból
|
||||
client.BaseAddress = new Uri(apiUrl);
|
||||
});
|
||||
|
||||
|
||||
builder.Services.AddHttpClient();
|
||||
builder.Services.AddDbContext<AppDbContext>();
|
||||
|
||||
builder.Services.AddSingleton<IConfiguration>(configuration);
|
||||
@@ -64,9 +62,9 @@ namespace WorkFlowCheck.MAUI
|
||||
#if DEBUG
|
||||
builder.Logging.AddDebug();
|
||||
#endif
|
||||
// HttpClient regisztrálása az alap API-címmel
|
||||
|
||||
var app = builder.Build();
|
||||
// Szolgáltató tárolása globálisan
|
||||
|
||||
ServiceProvider = app.Services;
|
||||
return app;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user