Unsubscribe link in emails sent
This commit is contained in:
@@ -1,4 +1,8 @@
|
||||
use crate::{routes::AppError, startup::AppState, templates::UnsubscribeTemplate};
|
||||
use crate::{
|
||||
routes::AppError,
|
||||
startup::AppState,
|
||||
templates::{NotFoundTemplate, UnsubscribeTemplate},
|
||||
};
|
||||
use anyhow::Context;
|
||||
use askama::Template;
|
||||
use axum::{
|
||||
@@ -29,7 +33,11 @@ pub async fn unsubscribe(
|
||||
.context("Could not update subscriptions table.")?;
|
||||
|
||||
if result.rows_affected() == 0 {
|
||||
Ok(StatusCode::NOT_FOUND.into_response())
|
||||
Ok((
|
||||
StatusCode::NOT_FOUND,
|
||||
Html(NotFoundTemplate.render().unwrap()),
|
||||
)
|
||||
.into_response())
|
||||
} else {
|
||||
Ok(Html(UnsubscribeTemplate.render().unwrap()).into_response())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user