Update code in endpoints/api/v1/endpoint.post.py
This commit is contained in:
parent
d22a7f0396
commit
cea12992b1
22
endpoints/api/v1/endpoint.post.py
Normal file
22
endpoints/api/v1/endpoint.post.py
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
from fastapi import APIRouter, Depends, HTTPException
|
||||||
|
from core.database import fake_users_db
|
||||||
|
from core.auth import get_current_user_dummy
|
||||||
|
|
||||||
|
router = APIRouter()
|
||||||
|
|
||||||
|
@router.post("/logout")
|
||||||
|
async def logout_demo(
|
||||||
|
current_user: dict = Depends(get_current_user_dummy)
|
||||||
|
):
|
||||||
|
"""Demo logout endpoint"""
|
||||||
|
if not current_user:
|
||||||
|
raise HTTPException(status_code=401, detail="Not authenticated")
|
||||||
|
|
||||||
|
return {
|
||||||
|
"message": "Logout successful",
|
||||||
|
"user": current_user["username"],
|
||||||
|
"metadata": {
|
||||||
|
"session_ended": True,
|
||||||
|
"timestamp": "demo_timestamp"
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user