16 lines
492 B
Python
16 lines
492 B
Python
from fastapi import APIRouter, HTTPException, status
|
|
from typing import Dict, Any
|
|
from helpers.generic_helpers import login_user
|
|
|
|
router = APIRouter()
|
|
|
|
@router.post("/login", status_code=status.HTTP_200_OK, response_model=Dict[str, Any])
|
|
async def login(
|
|
user_data: Dict[str, Any]
|
|
):
|
|
"""Login user"""
|
|
try:
|
|
login_response = login_user(user_data=user_data)
|
|
return login_response
|
|
except ValueError as e:
|
|
raise HTTPException(status_code=400, detail=str(e)) |