FastUI
FastUI copied to clipboard
Return RedirectResponse or jinja2Templates' TemplateResponse from an endpoint?
I need to redirect the page to some template HTML pages within a fastui endpoint procedure, for example, I need to show the home template page when home link is clicked. so I tried
@router.get('/home', response_model=FastUI, response_model_exclude_none=True)
def home(request: Request) -> list[AnyComponent]:
return templates.TemplateResponse(
name="home.html",
context={"request": request}
)
but then I will get
Request Error
Response not valid JSON
I am sure there must be a way to do it; I just didn't do it correctly. I would appreciate any help!
Is there no way to go to a template HTML page from a FastUI end point? I just wanted to redirect to a login page once logout endpoint is triggered. What is the recommended way to handle login with a customer login page that is based on template? @zboyles