Basic dashboard for newsletter issue and password systems
This commit is contained in:
@@ -1,11 +1,25 @@
|
||||
use crate::authentication::AuthenticatedUser;
|
||||
use askama::Template;
|
||||
use axum::{
|
||||
Extension,
|
||||
response::{Html, IntoResponse, Response},
|
||||
};
|
||||
use uuid::Uuid;
|
||||
|
||||
#[derive(Template)]
|
||||
#[template(path = "../templates/dashboard.html")]
|
||||
struct DashboardTemplate {
|
||||
username: String,
|
||||
idempotency_key: String,
|
||||
}
|
||||
|
||||
pub async fn admin_dashboard(
|
||||
Extension(AuthenticatedUser { username, .. }): Extension<AuthenticatedUser>,
|
||||
) -> Response {
|
||||
Html(format!(include_str!("html/dashboard.html"), username)).into_response()
|
||||
let idempotency_key = Uuid::new_v4().to_string();
|
||||
let template = DashboardTemplate {
|
||||
username,
|
||||
idempotency_key,
|
||||
};
|
||||
Html(template.render().unwrap()).into_response()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user