регистрация работает

This commit is contained in:
Николай 2023-05-15 19:12:19 +04:00
parent f6c5157c5d
commit ffe3f57242
2 changed files with 8 additions and 3 deletions

View File

@ -21,13 +21,13 @@ namespace HardwareShopRestApi.Controllers
}
[HttpGet]
public UserViewModel? Login(string login, string password)
public UserViewModel? Login(string email, string password)
{
try
{
return _logic.ReadElement(new UserSearchModel
{
Email = login,
Email = email,
Password = password
});
}

View File

@ -28,7 +28,7 @@ namespace HardwareShopWorkerApp.Controllers
{
throw new Exception("Введите логин, email, пароль");
}
APIClient.PostRequest("api/client/register", new UserBindingModel
APIClient.PostRequest("api/user/register", new UserBindingModel
{
Login = login,
Email = email,
@ -67,6 +67,11 @@ namespace HardwareShopWorkerApp.Controllers
{
throw new Exception("Введите почту и пароль");
}
APIClient.User = APIClient.GetRequest<UserViewModel>($"api/user/login?email={email}&password={password}");
if (APIClient.User == null)
{
throw new Exception("Неверные почта и/или пароль");
}
Response.Redirect("MainWorker");
}