From 3e8f8b34c12fb5b02bff0bfb467c04c76c15b0a4 Mon Sep 17 00:00:00 2001 From: Samuel Colvin Date: Thu, 30 Nov 2023 17:46:16 +0000 Subject: [PATCH] fix tables endpoints --- python/demo/__init__.py | 2 +- python/demo/main.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/python/demo/__init__.py b/python/demo/__init__.py index 8788fd1a..461d0b35 100644 --- a/python/demo/__init__.py +++ b/python/demo/__init__.py @@ -27,8 +27,8 @@ async def lifespan(app_: FastAPI): else: app = FastAPI(lifespan=lifespan) -app.include_router(main_router, prefix='/api') app.include_router(table_router, prefix='/api/table') +app.include_router(main_router, prefix='/api') @app.get('/robots.txt', response_class=PlainTextResponse) diff --git a/python/demo/main.py b/python/demo/main.py index eafbf62b..46a545a5 100644 --- a/python/demo/main.py +++ b/python/demo/main.py @@ -70,7 +70,7 @@ def api_index() -> list[AnyComponent]: ), ], ), - # c.ServerLoad(path='/sse', sse=True), + c.ServerLoad(path='/sse', sse=True), c.Modal( title='Static Modal', body=[c.Paragraph(text='This is some static content in a modal.')], @@ -240,9 +240,9 @@ async def form_post(form: Annotated[MyFormModel, fastui_form(MyFormModel)]) -> F async def sse_generator() -> AsyncIterable[str]: while True: d = datetime.now() - m = FastUI(root=[c.Div(components=[c.Text(text=f'Time {d:%H:%M:%S.%f}'[:-4])], class_name='font-monospace')]) + m = FastUI(root=[c.Div(components=[c.Text(text=f'Time {d:%H:%M:%S}')], class_name='font-monospace')]) yield f'data: {m.model_dump_json(by_alias=True)}\n\n' - await asyncio.sleep(0.09) + await asyncio.sleep(1) @router.get('/sse')