Backend/e-suite.CustomerApi/e-suite.CustomerApi/Domain.cs
2026-01-20 21:50:10 +00:00

23 lines
798 B
C#

using System.Net.Http.Headers;
using System.Text.Json;
using e_suite.API.Common.models;
using e_suite.CustomerApi.Helper;
using e_suite.CustomerApi.models;
namespace e_suite.CustomerApi;
public class Domain
{
public async Task<IEnumerable<GetDomain>> GetDomains()
{
var client = HttpHelper.CreateClient();
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", ApiSettings.Instance.Token);
client.BaseAddress = ApiSettings.Instance.BaseUrl;
var response = await client.GetAsync("Domain/domains?page=0");
var responseString = await response.Content.ReadAsStringAsync();
var result = JsonSerializer.Deserialize<Paginated<GetDomain>>(responseString);
return result.Data;
}
}