Add customer communication system
This commit is contained in:
30
LittleShop/Controllers/AuthController.cs
Normal file
30
LittleShop/Controllers/AuthController.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using LittleShop.DTOs;
|
||||
using LittleShop.Services;
|
||||
|
||||
namespace LittleShop.Controllers;
|
||||
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class AuthController : ControllerBase
|
||||
{
|
||||
private readonly IAuthService _authService;
|
||||
|
||||
public AuthController(IAuthService authService)
|
||||
{
|
||||
_authService = authService;
|
||||
}
|
||||
|
||||
[HttpPost("login")]
|
||||
public async Task<ActionResult<AuthResponseDto>> Login([FromBody] LoginDto loginDto)
|
||||
{
|
||||
var result = await _authService.LoginAsync(loginDto);
|
||||
|
||||
if (result != null)
|
||||
{
|
||||
return Ok(result);
|
||||
}
|
||||
|
||||
return Unauthorized(new { message = "Invalid credentials" });
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user