fix: fetch wallets for admin (#51)

This commit is contained in:
Vlad Stan 2025-12-11 17:32:22 +02:00 committed by GitHub
parent d0f1089f08
commit 5a078f2bfc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 14 additions and 23 deletions

View file

@ -1,6 +1,7 @@
from fastapi import APIRouter, Depends, Request
from fastapi.responses import HTMLResponse
from lnbits.core.models import User
from lnbits.core.crud.users import get_user_from_account
from lnbits.core.models.users import Account
from lnbits.decorators import check_admin
from lnbits.helpers import template_renderer
@ -12,7 +13,10 @@ def nostr_renderer():
@nostrclient_generic_router.get("/", response_class=HTMLResponse)
async def index(request: Request, user: User = Depends(check_admin)):
async def index(request: Request, account: Account = Depends(check_admin)):
user = await get_user_from_account(account)
if not user:
return HTMLResponse("No user found", status_code=404)
return nostr_renderer().TemplateResponse(
"nostrclient/index.html", {"request": request, "user": user.json()}
)