use http_body_util::Full; use hyper::body::Bytes; use hyper::header::CACHE_CONTROL; use hyper::Response; use std::collections::HashMap; use crate::controller::utils; use crate::controller::wallet::Wallet; // TODO error code pub fn error( wallet: &Wallet, title: &str, message: &str, ) -> Response> { utils::with_headers( Response::new( template(&wallet.assets, &wallet.templates, title, message).into(), ), vec![(CACHE_CONTROL, "no-cache")], ) } pub fn template( assets: &HashMap, templates: &minijinja::Environment<'_>, title: &str, message: &str, ) -> String { let context = minijinja::context!( title => title, message => message, assets => assets ); templates.render_str("error.html", &context).unwrap() }