Update code in endpoints/logout.get.py
This commit is contained in:
parent
f5c2285708
commit
f947a845af
20
endpoints/logout.get.py
Normal file
20
endpoints/logout.get.py
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
# Entity: Auth
|
||||||
|
|
||||||
|
```python
|
||||||
|
from fastapi import APIRouter, Depends, Response
|
||||||
|
from core.database import get_db
|
||||||
|
from sqlalchemy.orm import Session
|
||||||
|
from helpers.auth_helpers import logout_user
|
||||||
|
from schemas.auth import LogoutResponse
|
||||||
|
|
||||||
|
router = APIRouter()
|
||||||
|
|
||||||
|
@router.get("/logout", status_code=200, response_model=LogoutResponse)
|
||||||
|
async def logout(
|
||||||
|
response: Response,
|
||||||
|
db: Session = Depends(get_db)
|
||||||
|
):
|
||||||
|
"""Logout user by clearing auth cookies"""
|
||||||
|
logout_user(response)
|
||||||
|
return {"message": "Successfully logged out"}
|
||||||
|
```
|
Loading…
x
Reference in New Issue
Block a user