Confirmation page and minor improvements to homepage and form messages

Basic redirect with flash messages for success and error messages
This commit is contained in:
Alphonse Paix
2025-09-16 16:47:28 +02:00
parent f948728348
commit b736e2fe8d
12 changed files with 102 additions and 75 deletions

View File

@@ -1,11 +1,19 @@
use askama::Template;
use axum::response::Html;
use axum_messages::Messages;
#[derive(Template)]
#[template(path = "../templates/home.html")]
struct HomeTemplate;
struct HomeTemplate {
message: String,
}
pub async fn home() -> Html<String> {
let template = HomeTemplate;
pub async fn home(messages: Messages) -> Html<String> {
let template = HomeTemplate {
message: messages
.last()
.map(|msg| msg.to_string())
.unwrap_or_default(),
};
Html(template.render().unwrap())
}