Basic dashboard for newsletter issue and password systems
This commit is contained in:
@@ -8,11 +8,10 @@ use anyhow::Context;
|
||||
use axum::{
|
||||
Extension, Form,
|
||||
extract::State,
|
||||
response::{Html, IntoResponse, Redirect, Response},
|
||||
response::{IntoResponse, Redirect, Response},
|
||||
};
|
||||
use axum_messages::Messages;
|
||||
use sqlx::{Executor, Postgres, Transaction};
|
||||
use std::fmt::Write;
|
||||
use uuid::Uuid;
|
||||
|
||||
#[derive(serde::Deserialize)]
|
||||
@@ -23,19 +22,6 @@ pub struct BodyData {
|
||||
idempotency_key: String,
|
||||
}
|
||||
|
||||
pub async fn publish_newsletter_form(messages: Messages) -> Response {
|
||||
let mut error_html = String::new();
|
||||
for message in messages {
|
||||
writeln!(error_html, "<p><i>{}</i></p>", message).unwrap();
|
||||
}
|
||||
let idempotency_key = Uuid::new_v4();
|
||||
Html(format!(
|
||||
include_str!("html/send_newsletter_form.html"),
|
||||
idempotency_key, error_html
|
||||
))
|
||||
.into_response()
|
||||
}
|
||||
|
||||
#[tracing::instrument(skip_all)]
|
||||
pub async fn insert_newsletter_issue(
|
||||
transaction: &mut Transaction<'static, Postgres>,
|
||||
|
||||
Reference in New Issue
Block a user