Update code in endpoints/them.post.py
This commit is contained in:
parent
082c4dcfa9
commit
2c59b15de0
22
endpoints/them.post.py
Normal file
22
endpoints/them.post.py
Normal file
@ -0,0 +1,22 @@
|
||||
from fastapi import APIRouter, Depends, HTTPException
|
||||
from core.database import fake_users_db
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
@router.post("/logout")
|
||||
async def logout_handler(
|
||||
token: str = Depends(get_token_from_cookies)
|
||||
):
|
||||
"""Demo logout endpoint"""
|
||||
user = get_user_from_token(token)
|
||||
if not user:
|
||||
raise HTTPException(status_code=401, detail="Invalid token")
|
||||
|
||||
clear_cookies(token)
|
||||
|
||||
return {
|
||||
"message": "Logout successful",
|
||||
"next_steps": [
|
||||
"Login again to continue"
|
||||
]
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user