pod-b0of6k/endpoints/login.post.py

14 lines
506 B
Python

from fastapi import APIRouter, HTTPException, status
from typing import Dict, Any
from helpers.login_helpers import handle_login
router = APIRouter()
@router.post("/login", status_code=status.HTTP_200_OK, response_model=Dict[str, Any])
async def login_handler(login_data: Dict[str, Any]):
"""Handle user login"""
try:
login_response = handle_login(login_data=login_data)
return login_response
except ValueError as e:
raise HTTPException(status_code=400, detail=str(e))