Migration to using System.Net.Http.Json; part one - functional migration

This commit is contained in:
Pavel Vesely
2020-04-15 23:03:37 +02:00
parent fe2ad29b3b
commit 95e9bee4e2
29 changed files with 293 additions and 215 deletions

View File

@ -8,13 +8,11 @@ namespace Oqtane.Services
{
public class InstallationService : ServiceBase, IInstallationService
{
private readonly HttpClient _http;
private readonly SiteState _siteState;
private readonly NavigationManager _navigationManager;
public InstallationService(HttpClient http, SiteState siteState, NavigationManager navigationManager)
public InstallationService(HttpClient http, SiteState siteState, NavigationManager navigationManager):base(http)
{
_http = http;
_siteState = siteState;
_navigationManager = navigationManager;
}
@ -23,17 +21,17 @@ namespace Oqtane.Services
public async Task<Installation> IsInstalled()
{
return await _http.GetJsonAsync<Installation>($"{ApiUrl}/installed");
return await GetJsonAsync<Installation>($"{ApiUrl}/installed");
}
public async Task<Installation> Install(InstallConfig config)
{
return await _http.PostJsonAsync<Installation>(ApiUrl, config);
return await PostJsonAsync<InstallConfig,Installation>(ApiUrl, config);
}
public async Task<Installation> Upgrade()
{
return await _http.GetJsonAsync<Installation>($"{ApiUrl}/upgrade");
return await GetJsonAsync<Installation>($"{ApiUrl}/upgrade");
}
}
}