mirror of
https://github.com/resf/distro-tools.git
synced 2024-11-25 06:31:26 +00:00
17 lines
466 B
Python
17 lines
466 B
Python
from fastapi import APIRouter, Request
|
|
from fastapi.responses import RedirectResponse
|
|
|
|
router = APIRouter(tags=["non-api"])
|
|
|
|
|
|
@router.get("/")
|
|
async def logout(request: Request):
|
|
if request.session.get("user"):
|
|
request.session.pop("user")
|
|
if request.session.get("user.name"):
|
|
request.session.pop("user.name")
|
|
if request.session.get("user.role"):
|
|
request.session.pop("user.role")
|
|
|
|
return RedirectResponse("/", status_code=302)
|