lnbits-legend/lnbits/extensions/example/views.py
dni ⚡ 09871bbabc
fix mypy for extensions (#873)
* explicitly exclude all extensions from mypy

* fix example extension mypy

* fix subdomains extension mypy + 1 type error fixed

* fix mypy discordbot

* mypy check copilot extensnion

* copilot black

* add invoices ext to ignore

* add boltz and boltcard

* copilit id is necessary

* was discordbot is ok

Co-authored-by: dni <dni.khr@gmail.com>
2022-10-24 16:29:30 +02:00

21 lines
628 B
Python

from fastapi import FastAPI, Request
from fastapi.params import Depends
from fastapi.templating import Jinja2Templates
from starlette.responses import HTMLResponse
from lnbits.core.models import User
from lnbits.decorators import check_user_exists
from . import example_ext, example_renderer
templates = Jinja2Templates(directory="templates")
@example_ext.get("/", response_class=HTMLResponse)
async def index(
request: Request,
user: User = Depends(check_user_exists), # type: ignore
):
return example_renderer().TemplateResponse(
"example/index.html", {"request": request, "user": user.dict()}
)