Update code in endpoints/logout.post.py
This commit is contained in:
parent
2b50b1337d
commit
118bfc9c86
16
endpoints/logout.post.py
Normal file
16
endpoints/logout.post.py
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
from fastapi import APIRouter, Depends, HTTPException, status
|
||||||
|
from sqlalchemy.orm import Session
|
||||||
|
from core.database import get_db
|
||||||
|
from models.auth import Auth
|
||||||
|
from schemas.auth import LogoutResponse
|
||||||
|
from helpers.auth_helpers import logout_user
|
||||||
|
|
||||||
|
router = APIRouter()
|
||||||
|
|
||||||
|
@router.post("/logout", status_code=200, response_model=LogoutResponse)
|
||||||
|
async def logout(
|
||||||
|
db: Session = Depends(get_db)
|
||||||
|
):
|
||||||
|
"""Logout current user"""
|
||||||
|
result = logout_user(db)
|
||||||
|
return {"message": "Successfully logged out"}
|
Loading…
x
Reference in New Issue
Block a user