add method delete

This commit is contained in:
Valentin CZERYBA 2023-10-20 22:43:59 +02:00
parent 0d00df8194
commit 6e7970d5e3

View File

@ -35,3 +35,10 @@ async def check_token(current_user: Annotated[users.User, Depends(users_token.ge
content = {"message": "Check token"}
response = JSONResponse(content=content)
return response
@router.delete("/token",tags=["token"])
async def check_token(current_user: Annotated[users.User, Depends(users_token.get_current_active_user)], authorize: Annotated[bool, Depends(permissions_checker.PermissionChecker(roles=["Admin", "User"]))]):
content = {"message": "Token deleted"}
response = JSONResponse(content=content)
response.set_cookie(key="access_token", value="", httponly=True)
return response