Files
zero2prod/src/routes/admin/dashboard.rs
2025-09-20 04:43:55 +02:00

21 lines
605 B
Rust

use crate::{authentication::AuthenticatedUser, templates::DashboardTemplate};
use askama::Template;
use axum::{
Extension,
response::{Html, IntoResponse, Response},
};
use uuid::Uuid;
pub async fn admin_dashboard(
Extension(AuthenticatedUser { username, .. }): Extension<AuthenticatedUser>,
) -> Response {
let idempotency_key_1 = Uuid::new_v4().to_string();
let idempotency_key_2 = Uuid::new_v4().to_string();
let template = DashboardTemplate {
username,
idempotency_key_1,
idempotency_key_2,
};
Html(template.render().unwrap()).into_response()
}