HxRequestGuardLayer should take an (optional) redirect route
robertwayne opened this issue · comments
Rob commented
Probably like:
use axum::Router;
use axum_htmx::HxRequestGuardLayer;
fn protected_router() -> Router {
Router::new()
.layer(HxRequestGuardLayer::new().redirect_on_failure("/"))
}
EDIT: Possible that this could be default behavior, but it comes with the assumption that "/" will always resolve in a meaningful way, which may not (?) be the case. Could take an Option<&str> in the new fn to force this instead.