The smokesignal.events web application
1use anyhow::Result;
2use axum::response::IntoResponse;
3use axum_template::RenderHtml;
4use minijinja::context as template_context;
5
6use crate::http::context::{AdminRequestContext, admin_template_context};
7
8use super::errors::WebError;
9
10pub(crate) async fn handle_admin_index(
11 admin_ctx: AdminRequestContext,
12) -> Result<impl IntoResponse, WebError> {
13 // User is already verified as admin by the extractor
14 let canonical_url = format!(
15 "https://{}/admin",
16 admin_ctx.web_context.config.external_base
17 );
18
19 Ok(RenderHtml(
20 "en-us/admin.html",
21 admin_ctx.web_context.engine.clone(),
22 template_context! {
23 ..admin_template_context(&admin_ctx, &canonical_url, "index"),
24 },
25 )
26 .into_response())
27}