forked from lnbits/nostrmarket
-
Notifications
You must be signed in to change notification settings - Fork 0
/
views.py
30 lines (22 loc) · 891 Bytes
/
views.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import json
from http import HTTPStatus
from fastapi import Depends, Query, Request
from fastapi.templating import Jinja2Templates
from loguru import logger
from starlette.responses import HTMLResponse
from lnbits.core.models import User
from lnbits.decorators import check_user_exists
from . import nostrmarket_ext, nostrmarket_renderer
templates = Jinja2Templates(directory="templates")
@nostrmarket_ext.get("/", response_class=HTMLResponse)
async def index(request: Request, user: User = Depends(check_user_exists)):
return nostrmarket_renderer().TemplateResponse(
"nostrmarket/index.html",
{"request": request, "user": user.dict()},
)
@nostrmarket_ext.get("/market", response_class=HTMLResponse)
async def market(request: Request):
return nostrmarket_renderer().TemplateResponse(
"nostrmarket/market.html",
{"request": request},
)