GCR deployment testing in progress - css issue remaining
This commit is contained in:
@@ -1,24 +0,0 @@
|
|||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
|
||||||
# Visual Studio Version 17
|
|
||||||
VisualStudioVersion = 17.5.2.0
|
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Htmx.ApiDemo", "Htmx.ApiDemo.csproj", "{38A5EDEF-D21B-8D4E-D1F2-DDFE0335BD22}"
|
|
||||||
EndProject
|
|
||||||
Global
|
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
|
||||||
Debug|Any CPU = Debug|Any CPU
|
|
||||||
Release|Any CPU = Release|Any CPU
|
|
||||||
EndGlobalSection
|
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
|
||||||
{38A5EDEF-D21B-8D4E-D1F2-DDFE0335BD22}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{38A5EDEF-D21B-8D4E-D1F2-DDFE0335BD22}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{38A5EDEF-D21B-8D4E-D1F2-DDFE0335BD22}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{38A5EDEF-D21B-8D4E-D1F2-DDFE0335BD22}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
EndGlobalSection
|
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
|
||||||
HideSolutionNode = FALSE
|
|
||||||
EndGlobalSection
|
|
||||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
|
||||||
SolutionGuid = {B66FEAA2-59A2-4489-9AEB-ED875EEE5D3E}
|
|
||||||
EndGlobalSection
|
|
||||||
EndGlobal
|
|
||||||
+14
-13
@@ -1,8 +1,8 @@
|
|||||||
using Htmx.ApiDemo;
|
using Htmx.ApiDemo;
|
||||||
using Htmx.ApiDemo.Data;
|
using Htmx.ApiDemo.Data;
|
||||||
using Immediate.Apis;
|
using Immediate.Handlers;
|
||||||
using Immediate.Apis.Shared;
|
|
||||||
using Microsoft.AspNetCore.Authentication.Cookies;
|
using Microsoft.AspNetCore.Authentication.Cookies;
|
||||||
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.AspNetCore.Identity;
|
using Microsoft.AspNetCore.Identity;
|
||||||
using MongoDB.Bson;
|
using MongoDB.Bson;
|
||||||
using MongoDB.Bson.Serialization;
|
using MongoDB.Bson.Serialization;
|
||||||
@@ -102,45 +102,46 @@ app.Use(async (context, next) =>
|
|||||||
await next();
|
await next();
|
||||||
});
|
});
|
||||||
|
|
||||||
// Explicit MapGet/MapPost so RequestDelegateGenerator can intercept and emit
|
// Explicit MapGet/MapPost with explicit lambda return type ValueTask<IResult>.
|
||||||
// NativeAOT-safe endpoint code. Handlers return ValueTask<IResult> which the
|
// The explicit return type annotation lets RequestDelegateGenerator see IResult
|
||||||
// generator knows how to handle: it emits `await result.ExecuteAsync(httpContext)`.
|
// directly (without needing to resolve the generated Handler.HandleAsync type),
|
||||||
app.MapGet("/", static (
|
// so it emits `await result.ExecuteAsync(httpContext)` instead of JSON serialization.
|
||||||
|
app.MapGet("/", static ValueTask<IResult> (
|
||||||
[AsParameters] Htmx.ApiDemo.Templates.GetIndexHandler.Command cmd,
|
[AsParameters] Htmx.ApiDemo.Templates.GetIndexHandler.Command cmd,
|
||||||
Htmx.ApiDemo.Templates.GetIndexHandler.Handler handler,
|
Htmx.ApiDemo.Templates.GetIndexHandler.Handler handler,
|
||||||
CancellationToken token) => handler.HandleAsync(cmd, token));
|
CancellationToken token) => handler.HandleAsync(cmd, token));
|
||||||
|
|
||||||
app.MapGet("/greet/{username}/{count?}/{id?}", static (
|
app.MapGet("/greet/{username}/{count?}/{id?}", static ValueTask<IResult> (
|
||||||
[AsParameters] Htmx.ApiDemo.Templates.GetGreetingHandler.Query query,
|
[AsParameters] Htmx.ApiDemo.Templates.GetGreetingHandler.Query query,
|
||||||
Htmx.ApiDemo.Templates.GetGreetingHandler.Handler handler,
|
Htmx.ApiDemo.Templates.GetGreetingHandler.Handler handler,
|
||||||
CancellationToken token) => handler.HandleAsync(query, token));
|
CancellationToken token) => handler.HandleAsync(query, token));
|
||||||
|
|
||||||
app.MapGet("/login", static (
|
app.MapGet("/login", static ValueTask<IResult> (
|
||||||
[AsParameters] Htmx.ApiDemo.Templates.GetLoginHandler.Query query,
|
[AsParameters] Htmx.ApiDemo.Templates.GetLoginHandler.Query query,
|
||||||
Htmx.ApiDemo.Templates.GetLoginHandler.Handler handler,
|
Htmx.ApiDemo.Templates.GetLoginHandler.Handler handler,
|
||||||
CancellationToken token) => handler.HandleAsync(query, token));
|
CancellationToken token) => handler.HandleAsync(query, token));
|
||||||
|
|
||||||
app.MapPost("/login", static (
|
app.MapPost("/login", static ValueTask<IResult> (
|
||||||
[AsParameters] Htmx.ApiDemo.Templates.PostLoginHandler.Command cmd,
|
[AsParameters] Htmx.ApiDemo.Templates.PostLoginHandler.Command cmd,
|
||||||
Htmx.ApiDemo.Templates.PostLoginHandler.Handler handler,
|
Htmx.ApiDemo.Templates.PostLoginHandler.Handler handler,
|
||||||
CancellationToken token) => handler.HandleAsync(cmd, token));
|
CancellationToken token) => handler.HandleAsync(cmd, token));
|
||||||
|
|
||||||
app.MapGet("/register", static (
|
app.MapGet("/register", static ValueTask<IResult> (
|
||||||
[AsParameters] Htmx.ApiDemo.Templates.GetRegisterHandler.Query query,
|
[AsParameters] Htmx.ApiDemo.Templates.GetRegisterHandler.Query query,
|
||||||
Htmx.ApiDemo.Templates.GetRegisterHandler.Handler handler,
|
Htmx.ApiDemo.Templates.GetRegisterHandler.Handler handler,
|
||||||
CancellationToken token) => handler.HandleAsync(query, token));
|
CancellationToken token) => handler.HandleAsync(query, token));
|
||||||
|
|
||||||
app.MapPost("/register", static (
|
app.MapPost("/register", static ValueTask<IResult> (
|
||||||
[AsParameters] Htmx.ApiDemo.Templates.PostRegisterHandler.Command cmd,
|
[AsParameters] Htmx.ApiDemo.Templates.PostRegisterHandler.Command cmd,
|
||||||
Htmx.ApiDemo.Templates.PostRegisterHandler.Handler handler,
|
Htmx.ApiDemo.Templates.PostRegisterHandler.Handler handler,
|
||||||
CancellationToken token) => handler.HandleAsync(cmd, token));
|
CancellationToken token) => handler.HandleAsync(cmd, token));
|
||||||
|
|
||||||
app.MapPost("/logout", static (
|
app.MapPost("/logout", static ValueTask<IResult> (
|
||||||
[AsParameters] Htmx.ApiDemo.Templates.PostLogoutHandler.Command cmd,
|
[AsParameters] Htmx.ApiDemo.Templates.PostLogoutHandler.Command cmd,
|
||||||
Htmx.ApiDemo.Templates.PostLogoutHandler.Handler handler,
|
Htmx.ApiDemo.Templates.PostLogoutHandler.Handler handler,
|
||||||
CancellationToken token) => handler.HandleAsync(cmd, token));
|
CancellationToken token) => handler.HandleAsync(cmd, token));
|
||||||
|
|
||||||
app.MapGet("/ui-demo", static (
|
app.MapGet("/ui-demo", static ValueTask<IResult> (
|
||||||
[AsParameters] Htmx.ApiDemo.Templates.GetUiDemoHandler.Query query,
|
[AsParameters] Htmx.ApiDemo.Templates.GetUiDemoHandler.Query query,
|
||||||
Htmx.ApiDemo.Templates.GetUiDemoHandler.Handler handler,
|
Htmx.ApiDemo.Templates.GetUiDemoHandler.Handler handler,
|
||||||
CancellationToken token) => handler.HandleAsync(query, token));
|
CancellationToken token) => handler.HandleAsync(query, token));
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
|
using Htmx.ApiDemo;
|
||||||
using Htmx.ApiDemo.Data;
|
using Htmx.ApiDemo.Data;
|
||||||
using Immediate.Apis.Shared;
|
using Immediate.Apis.Shared;
|
||||||
using Immediate.Handlers.Shared;
|
using Immediate.Handlers.Shared;
|
||||||
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
namespace Htmx.ApiDemo.Templates;
|
namespace Htmx.ApiDemo.Templates;
|
||||||
@@ -13,16 +15,13 @@ public static partial class PostLogoutHandler
|
|||||||
// and antiforgery token in the form is validated by the middleware.
|
// and antiforgery token in the form is validated by the middleware.
|
||||||
public class Command;
|
public class Command;
|
||||||
|
|
||||||
private static async ValueTask HandleAsync(
|
private static async ValueTask<IResult> HandleAsync(
|
||||||
[AsParameters] Command _,
|
[AsParameters] Command _,
|
||||||
AuthService authService,
|
AuthService authService,
|
||||||
IHttpContextAccessor httpContextAccessor,
|
IHttpContextAccessor httpContextAccessor,
|
||||||
CancellationToken token)
|
CancellationToken token)
|
||||||
{
|
{
|
||||||
await authService.SignOutAsync();
|
await authService.SignOutAsync();
|
||||||
|
return new HtmxResult("/login");
|
||||||
var ctx = httpContextAccessor.HttpContext
|
|
||||||
?? throw new InvalidOperationException("HttpContext is not available.");
|
|
||||||
ctx.Response.Redirect("/login");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user