Converted views
This commit is contained in:
@@ -6,17 +6,21 @@ from lnbits.decorators import check_user_exists, validate_uuids
|
||||
from . import satspay_ext
|
||||
from .crud import get_charge
|
||||
|
||||
from fastapi import FastAPI, Request
|
||||
from fastapi.templating import Jinja2Templates
|
||||
|
||||
templates = Jinja2Templates(directory="templates")
|
||||
|
||||
@satspay_ext.route("/")
|
||||
@validate_uuids(["usr"], required=True)
|
||||
@check_user_exists()
|
||||
async def index():
|
||||
return await render_template("satspay/index.html", user=g.user)
|
||||
async def index(request: Request):
|
||||
return await templates.TemplateResponse("satspay/index.html", {"request":request, "user":g.user})
|
||||
|
||||
|
||||
@satspay_ext.route("/<charge_id>")
|
||||
async def display(charge_id):
|
||||
async def display(request: Request, charge_id):
|
||||
charge = await get_charge(charge_id) or abort(
|
||||
HTTPStatus.NOT_FOUND, "Charge link does not exist."
|
||||
)
|
||||
return await render_template("satspay/display.html", charge=charge)
|
||||
return await templates.TemplateResponse("satspay/display.html", {"request":request, "charge":charge})
|
||||
|
||||
Reference in New Issue
Block a user