Fix send email request body
This commit is contained in:
@@ -20,7 +20,7 @@ fn generate_subscription_token() -> String {
|
||||
|
||||
#[tracing::instrument(
|
||||
name = "Adding a new subscriber",
|
||||
skip(connection_pool, form, email_client),
|
||||
skip(connection_pool, email_client, base_url, form),
|
||||
fields(
|
||||
subscriber_email = %form.email,
|
||||
subscriber_name = %form.name
|
||||
@@ -50,18 +50,19 @@ pub async fn subscribe(
|
||||
{
|
||||
return StatusCode::INTERNAL_SERVER_ERROR;
|
||||
}
|
||||
if send_confirmation_email(
|
||||
if let Err(e) = send_confirmation_email(
|
||||
&email_client,
|
||||
&new_subscriber,
|
||||
&base_url,
|
||||
&subscription_token,
|
||||
)
|
||||
.await
|
||||
.is_err()
|
||||
{
|
||||
tracing::error!("Could not send confirmation email: {:?}", e);
|
||||
return StatusCode::INTERNAL_SERVER_ERROR;
|
||||
}
|
||||
if transaction.commit().await.is_err() {
|
||||
if let Err(e) = transaction.commit().await {
|
||||
tracing::error!("Failed to commit transaction: {:?}", e);
|
||||
return StatusCode::INTERNAL_SERVER_ERROR;
|
||||
}
|
||||
StatusCode::OK
|
||||
|
||||
Reference in New Issue
Block a user