classlib/ExpenseTracker.Application/Authentication/Queries/Login/LoginQueryHandler.cs
2024-08-07 21:12:02 +03:00

20 lines
655 B
C#

using ExpenseTracker.Application.Common.Interfaces.Services;
using MediatR;
namespace ExpenseTracker.Application.Authentication.Queries.Login;
public class LoginQueryHandler : IRequestHandler<LoginQuery, TokensModel>
{
private readonly IAuthenticationService _authenticationService;
public LoginQueryHandler(IAuthenticationService authenticationService)
{
_authenticationService = authenticationService;
}
public async Task<TokensModel> Handle(LoginQuery request, CancellationToken cancellationToken)
{
return await _authenticationService.LoginAsync(request.Email, request.Password, cancellationToken);
}
}