Admin dashboard and sessions
This commit is contained in:
@@ -87,7 +87,7 @@ pub async fn subscribe(
|
||||
base_url,
|
||||
..
|
||||
}): State<AppState>,
|
||||
Form(form): Form<FormData>,
|
||||
Form(form): Form<SubscriptionFormData>,
|
||||
) -> Result<Response, SubscribeError> {
|
||||
let mut transaction = connection_pool
|
||||
.begin()
|
||||
@@ -195,15 +195,15 @@ Click <a href=\"{}\">here</a> to confirm your subscription.",
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[allow(dead_code)]
|
||||
pub struct FormData {
|
||||
pub struct SubscriptionFormData {
|
||||
name: String,
|
||||
email: String,
|
||||
}
|
||||
|
||||
impl TryFrom<FormData> for NewSubscriber {
|
||||
impl TryFrom<SubscriptionFormData> for NewSubscriber {
|
||||
type Error = String;
|
||||
|
||||
fn try_from(value: FormData) -> Result<Self, Self::Error> {
|
||||
fn try_from(value: SubscriptionFormData) -> Result<Self, Self::Error> {
|
||||
let name = SubscriberName::parse(value.name)?;
|
||||
let email = SubscriberEmail::parse(value.email)?;
|
||||
Ok(Self { name, email })
|
||||
|
||||
Reference in New Issue
Block a user