Migrating all validation to use HTMX and endpoints instead of WASM/Websocket connections
This commit is contained in:
@@ -1,27 +1,41 @@
|
||||
using Enciphered.Blazor.UIComponents.Demo;
|
||||
using Enciphered.Blazor.UIComponents.Demo.Components;
|
||||
using Enciphered.Blazor.UIComponents.Validation;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
// Add services to the container.
|
||||
builder.Services.AddRazorComponents();
|
||||
builder.Services.AddAntiforgery();
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
// Configure the HTTP request pipeline.
|
||||
if (!app.Environment.IsDevelopment())
|
||||
{
|
||||
app.UseExceptionHandler("/Error", createScopeForErrors: true);
|
||||
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
|
||||
app.UseHsts();
|
||||
}
|
||||
|
||||
app.UseHttpsRedirection();
|
||||
|
||||
|
||||
app.UseAntiforgery();
|
||||
|
||||
app.MapStaticAssets();
|
||||
app.MapRazorComponents<App>()
|
||||
.AddAdditionalAssemblies(typeof(Enciphered.Blazor.UIComponents.SidebarProvider).Assembly);
|
||||
|
||||
app.MapFormValidation<ContactFormValidator, ContactFormModel>("/api/forms/contact",
|
||||
onSuccess: async model =>
|
||||
{
|
||||
Console.WriteLine("── Form Submitted ──");
|
||||
Console.WriteLine($" Name: {model.Name}");
|
||||
Console.WriteLine($" Email: {model.Email}");
|
||||
Console.WriteLine($" Password: {model.Password}");
|
||||
Console.WriteLine($" Age: {model.Age}");
|
||||
Console.WriteLine($" Birth Date: {model.Birthdate}");
|
||||
Console.WriteLine($" Time: {model.Preferredtime}");
|
||||
Console.WriteLine($" Appointment: {model.Appointment}");
|
||||
Console.WriteLine($" Confirmation: {model.Confirmation}");
|
||||
await Task.CompletedTask;
|
||||
});
|
||||
|
||||
app.Run();
|
||||
Reference in New Issue
Block a user