using Microsoft.AspNetCore.Components.Authorization; using Sandbox.Models.ViewModels; namespace Sandbox.App.Services.AuthService; public class AuthService : IAuthService { private readonly HttpClient _http; //private readonly AuthenticationStateProvider _authenticationStateProvider; // public AuthService(HttpClient httpClient, AuthenticationStateProvider authenticationStateProvider) public AuthService(HttpClient httpClient) { _http = httpClient; //_authenticationStateProvider = authenticationStateProvider; } public async Task> Register(UserRegister request) { var result = await _http.PostAsJsonAsync("api/auth/register", request); return await result.Content.ReadFromJsonAsync>(); } // public async Task> Login(UserLogin request) // { // var result = await _http.PostAsJsonAsync("api/auth/login", request); // return await result.Content.ReadFromJsonAsync>(); // } // // public async Task> ChangePassword(UserChangePassword request) // { // var result = await _http.PostAsJsonAsync("api/auth/change-password", request.Password); // return await result.Content.ReadFromJsonAsync>(); // } // public async Task IsUserAuthenticated() // { // return (await _authenticationStateProvider.GetAuthenticationStateAsync()).User.Identity.IsAuthenticated; // } }