Ошибка коммитов, пытаемся решить :(

This commit is contained in:
Кашин Максим 2023-04-06 18:04:38 +04:00
parent 6d4307aeeb
commit d20d5624a1

View File

@ -7,20 +7,20 @@ namespace HostrelHeadwaiterApp
{
public class APIClient
{
private static readonly HttpClient _client = new();
private static readonly HttpClient _headwaiter = new();
public static HeadwaiterViewModel? Client { get; set; } = null;
public static HeadwaiterViewModel? Headwaiter { get; set; } = null;
public static void Connect(IConfiguration configuration)
{
_client.BaseAddress = new Uri(configuration["IPAddress"]);
_client.DefaultRequestHeaders.Accept.Clear();
_client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
_headwaiter.BaseAddress = new Uri(configuration["IPAddress"]);
_headwaiter.DefaultRequestHeaders.Accept.Clear();
_headwaiter.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
}
public static T? GetRequest<T>(string requestUrl)
{
var response = _client.GetAsync(requestUrl);
var response = _headwaiter.GetAsync(requestUrl);
var result = response.Result.Content.ReadAsStringAsync().Result;
if (response.Result.IsSuccessStatusCode)
{
@ -37,7 +37,7 @@ namespace HostrelHeadwaiterApp
var json = JsonConvert.SerializeObject(model);
var data = new StringContent(json, Encoding.UTF8, "application/json");
var response = _client.PostAsync(requestUrl, data);
var response = _headwaiter.PostAsync(requestUrl, data);
var result = response.Result.Content.ReadAsStringAsync().Result;
if (!response.Result.IsSuccessStatusCode)