Merge branch 'FastAPI' of https://github.com/arcbtc/lnbits into FastAPI
This commit is contained in:
@@ -1,5 +1,12 @@
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
from fastapi.param_functions import Depends
|
||||
from starlette.exceptions import HTTPException
|
||||
from starlette.responses import HTMLResponse
|
||||
from lnbits.core.models import User
|
||||
>>>>>>> f827d2ce181d97368161d46ab8de2e9f061b9872
|
||||
from lnbits.core.crud import get_wallet
|
||||
from lnbits.decorators import check_user_exists, validate_uuids
|
||||
from lnbits.decorators import check_user_exists
|
||||
from http import HTTPStatus
|
||||
|
||||
from . import lnticket_ext, lnticket_renderer
|
||||
@@ -11,7 +18,9 @@ from fastapi.templating import Jinja2Templates
|
||||
templates = Jinja2Templates(directory="templates")
|
||||
|
||||
@lnticket_ext.get("/", response_class=HTMLResponse)
|
||||
@validate_uuids(["usr"], required=True)
|
||||
# not needed as we automatically get the user with the given ID
|
||||
# If no user with this ID is found, an error is raised
|
||||
# @validate_uuids(["usr"], required=True)
|
||||
# @check_user_exists()
|
||||
async def index(request: Request, user: User = Depends(check_user_exists)):
|
||||
return lnticket_renderer().TemplateResponse("lnticket/index.html", {"request": request,"user": user.dict()})
|
||||
|
||||
Reference in New Issue
Block a user