migrare UI in WebAssembly + integrare Serviciu stocare info pe web + WebToken

This commit is contained in:
andrei-mihnea-cerbu
2024-04-10 06:57:48 +03:00
parent 9977a9b5f5
commit adba50e70b
1915 changed files with 16113 additions and 99991 deletions
@@ -0,0 +1,104 @@
using HealthcareManagerUiWebAssem.Models;
using HealthcareManagerUiWebAssem.Services.Http;
namespace HealthcareManagerUiWebAssem.Services.Authentication;
public class AuthenticationService : IAuthenticationService
{
private readonly IRequestHttpService _requestHttpService;
public AuthenticationService(IRequestHttpService requestHttpService)
{
_requestHttpService = requestHttpService;
}
public async Task<BaseResponse> Login(UserLoginModel userLoginModel)
{
try
{
var response = await _requestHttpService.PostAsync("/Authorization/login", userLoginModel);
return response;
}
catch (Exception ex)
{
return new BaseResponse
{
StatusCode = HttpStatusCodes.InternalServerError,
Data = null,
Message = ex.Message
};
}
}
public async Task<BaseResponse> RegisterDoctor(UserRegisterModel userRegistrationModel)
{
try
{
var response = await _requestHttpService.PostAsync("/Doctors/register", userRegistrationModel);
return response;
}
catch (Exception ex)
{
return new BaseResponse
{
StatusCode = HttpStatusCodes.InternalServerError,
Data = null,
Message = ex.Message
};
}
}
public async Task<BaseResponse> RegisterPatient(UserRegisterModel userRegistrationModel)
{
try
{
var response = await _requestHttpService.PostAsync("/Doctors/register", userRegistrationModel);
return response;
}
catch (Exception ex)
{
return new BaseResponse
{
StatusCode = HttpStatusCodes.InternalServerError,
Data = null,
Message = ex.Message
};
}
}
public async Task<BaseResponse> ResetPassword(UserLoginModel dto)
{
try
{
var response = await _requestHttpService.PostAsync("/Authorization/reset_password", dto);
return response;
}
catch (Exception ex)
{
return new BaseResponse
{
StatusCode = HttpStatusCodes.InternalServerError,
Data = null,
Message = ex.Message
};
}
}
public async Task<BaseResponse> RefreshToken(TokenRefreshModel dto)
{
try
{
var response = await _requestHttpService.PostAsync("/Authorization/refresh_token", dto);
return response;
}
catch (Exception ex)
{
return new BaseResponse
{
StatusCode = HttpStatusCodes.InternalServerError,
Data = null,
Message = ex.Message
};
}
}
}
@@ -0,0 +1,12 @@
using HealthcareManagerUiWebAssem.Models;
namespace HealthcareManagerUiWebAssem.Services.Authentication;
public interface IAuthenticationService
{
Task<BaseResponse> Login(UserLoginModel userLoginModel);
Task<BaseResponse> RegisterPatient(UserRegisterModel userRegistrationModel);
Task<BaseResponse> RegisterDoctor(UserRegisterModel userRegistrationModel);
Task<BaseResponse> ResetPassword(UserLoginModel userResetPasswordModel);
Task<BaseResponse> RefreshToken(TokenRefreshModel dto);
}