Refactor to use IHttpClientFactory and remove ApiOptions
Replaced direct injection of HttpClient with IHttpClientFactory across the codebase to improve HTTP client management and align with best practices. Removed dependency on ApiOptions and IOptions<ApiOptions> in multiple services, simplifying constructors and reducing configuration complexity. Updated FontLoader to use IHttpClientFactory for font loading with relative paths. Adjusted comments and documentation to reflect these changes. Cleaned up unused using directives related to ApiOptions.
This commit is contained in:
@@ -15,13 +15,14 @@
|
||||
</div>
|
||||
|
||||
@code {
|
||||
[Inject] HttpClient Http { get; set; }
|
||||
[Inject] IHttpClientFactory HttpClientFactory { get; set; } = default!;
|
||||
|
||||
List<string> RequiredFonts = new() {
|
||||
"opensans.ttf"
|
||||
};
|
||||
|
||||
protected async override Task OnInitializedAsync() {
|
||||
await FontLoader.LoadFonts(Http, RequiredFonts);
|
||||
await FontLoader.LoadFonts(HttpClientFactory, RequiredFonts);
|
||||
await base.OnInitializedAsync();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user