22 lines
845 B
Rust
22 lines
845 B
Rust
use maud::PreEscaped;
|
|
|
|
use crate::{templates, utils::sbot};
|
|
|
|
/// Scuttlebutt friends list template builder.
|
|
pub fn build_template() -> PreEscaped<String> {
|
|
// retrieve the list of friends
|
|
match sbot::get_friends_list() {
|
|
// populate the peers_list template with friends and render it
|
|
Ok(friends) => templates::peers_list::build_template(friends, "Friends"),
|
|
Err(e) => {
|
|
// render the sbot error template with the error message
|
|
let error_template = templates::error::build_template(e.to_string());
|
|
// wrap the nav bars around the error template content
|
|
let body = templates::nav::build_template(error_template, "Friends", Some("/"));
|
|
|
|
// render the base template with the provided body
|
|
templates::base::build_template(body)
|
|
}
|
|
}
|
|
}
|