Test suite refactoring to match new htmx HTML swapping in pages

This commit is contained in:
Alphonse Paix
2025-09-17 14:16:27 +02:00
parent 7364e2a23c
commit bdddf0fe4a
8 changed files with 91 additions and 163 deletions

View File

@@ -7,7 +7,8 @@ use crate::{routes::error_chain_fmt, templates::ErrorTemplate};
use askama::Template;
use axum::{
Json,
response::{Html, IntoResponse, Redirect, Response},
http::HeaderMap,
response::{Html, IntoResponse, Response},
};
pub use change_password::*;
pub use dashboard::*;
@@ -52,7 +53,11 @@ impl IntoResponse for AdminError {
}),
)
.into_response(),
AdminError::NotAuthenticated => Redirect::to("/login").into_response(),
AdminError::NotAuthenticated => {
let mut headers = HeaderMap::new();
headers.insert("HX-Redirect", "/login".parse().unwrap());
(StatusCode::OK, headers).into_response()
}
AdminError::ChangePassword(e) => {
let template = ErrorTemplate {
error_message: e.to_owned(),