mirror of
https://github.com/resf/distro-tools.git
synced 2024-12-28 13:30:56 +00:00
16 lines
466 B
Python
16 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)
|