20 lines
527 B
Python
20 lines
527 B
Python
# 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"}
|
|
``` |