You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

30 lines
980 B

using FluentBlazorApp.DTOs;
using FluentBlazorApp.Responses;
using static FluentBlazorApp.Responses.CustomResponses;
namespace FluentBlazorApp.Services
{
public class AccountService : IAccountService
{
private readonly HttpClient _httpClient;
public AccountService(HttpClient httpClient)
{
_httpClient = httpClient;
}
public async Task<LoginResponse> LoginAsync(LoginDTO model)
{
var resonse = await _httpClient.PostAsJsonAsync("api/account/login", model);
var result = await resonse.Content.ReadFromJsonAsync<LoginResponse>();
return result;
}
public async Task<RegistrationResonse> RegisterAsync(RegisterDTO model)
{
var resonse = await _httpClient.PostAsJsonAsync("api/account/register", model);
var result = await resonse.Content.ReadFromJsonAsync<RegistrationResonse>();
return result;
}
}
}