Removed Immediate.Apis, Added AOT Testing Scripts.
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Htmx.ApiDemo.Templates;
|
||||
|
||||
namespace Htmx.ApiDemo;
|
||||
|
||||
public static partial class RouteMap
|
||||
{
|
||||
private static void GetUiDemo(WebApplication app)
|
||||
=> app.MapGet("/ui-demo", (IHttpContextAccessor contextAccessor) =>
|
||||
{
|
||||
var context = contextAccessor.HttpContext
|
||||
?? throw new InvalidOperationException("HttpContext is not available.");
|
||||
|
||||
if (context.User.Identity?.IsAuthenticated == false)
|
||||
{
|
||||
context.Response.Redirect("/login");
|
||||
return;
|
||||
}
|
||||
|
||||
var uiDemoComponent = new UiDemo();
|
||||
uiDemoComponent.HtmxAwareWriteToBody(
|
||||
context: context,
|
||||
title: "UI Demo",
|
||||
appName: "HtmxApp",
|
||||
pageTitle: "Htmx UI Demo"
|
||||
);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user