Messages now have a title and a message

This commit is contained in:
Slatian 2023-02-21 08:55:29 +01:00
parent b9fc472120
commit c4379d4c19
2 changed files with 6 additions and 3 deletions

View File

@ -264,7 +264,10 @@ async fn hello_world_handler(
state.templating_engine.render_view( state.templating_engine.render_view(
&settings, &settings,
&View::Message("Hello! There, You, Awesome Creature!".to_string()) &View::Message{
title: "Hey There!".to_string(),
message: "You,You are an awesome Creature!".to_string()
},
).await ).await
} }

View File

@ -56,7 +56,7 @@ pub enum View {
Dig { query: DigQuery, result: simple_dns::DnsLookupResult }, Dig { query: DigQuery, result: simple_dns::DnsLookupResult },
Index { query: IpQuery, result: IpResult }, Index { query: IpQuery, result: IpResult },
Ip { query: IpQuery, result: IpResult }, Ip { query: IpQuery, result: IpResult },
Message(String), Message{ title: String, message: String },
#[serde(rename="404")] #[serde(rename="404")]
NotFound, NotFound,
} }
@ -67,7 +67,7 @@ impl View {
View::Dig{..} => "dig", View::Dig{..} => "dig",
View::Index{..} => "index", View::Index{..} => "index",
View::Ip{..} => "ip", View::Ip{..} => "ip",
View::Message(..) => "message", View::Message{..} => "message",
View::NotFound => "404", View::NotFound => "404",
}.to_string() }.to_string()
} }