updates to the ui and email system
This commit is contained in:
parent
80c8a3e8a8
commit
612451cfc9
|
@ -12,7 +12,7 @@
|
||||||
const age = calculate_age(birthdate);
|
const age = calculate_age(birthdate);
|
||||||
data.append("age", age);
|
data.append("age", age);
|
||||||
|
|
||||||
let base = "https://api.tfcconnection.org/mt-form";
|
let base = "/api/mt-form";
|
||||||
/* let base = "http://localhost:4242/mt-form"; */
|
/* let base = "http://localhost:4242/mt-form"; */
|
||||||
|
|
||||||
fetch(base, {
|
fetch(base, {
|
||||||
|
@ -78,7 +78,7 @@
|
||||||
|
|
||||||
<div id="mt-form" class="form text-lg w-full">
|
<div id="mt-form" class="form text-lg w-full">
|
||||||
<form id='form'
|
<form id='form'
|
||||||
hx-post="http://localhost:4242/mt-form"
|
hx-post="/api/mt-form"
|
||||||
hx-encoding="multipart/form-data"
|
hx-encoding="multipart/form-data"
|
||||||
autocomplete="on"
|
autocomplete="on"
|
||||||
method="post"
|
method="post"
|
||||||
|
|
|
@ -218,7 +218,7 @@ impl MtForm {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[post("/mt-form")]
|
#[post("/api/mt-form")]
|
||||||
pub async fn mt_form(MultipartForm(form): MultipartForm<MtForm>) -> HttpResponse {
|
pub async fn mt_form(MultipartForm(form): MultipartForm<MtForm>) -> HttpResponse {
|
||||||
let first = form.first_name.clone();
|
let first = form.first_name.clone();
|
||||||
let last = form.last_name.clone();
|
let last = form.last_name.clone();
|
||||||
|
@ -269,11 +269,11 @@ pub async fn mt_form(MultipartForm(form): MultipartForm<MtForm>) -> HttpResponse
|
||||||
.unwrap(),
|
.unwrap(),
|
||||||
)
|
)
|
||||||
.to("Chris Cochrun <chris@tfcconnection.org>".parse().unwrap())
|
.to("Chris Cochrun <chris@tfcconnection.org>".parse().unwrap())
|
||||||
.to("Ethan Rose <ethan@tfcconnection.org>".parse().unwrap())
|
|
||||||
.subject(email_subject)
|
.subject(email_subject)
|
||||||
.multipart(multi)
|
.multipart(multi)
|
||||||
{
|
{
|
||||||
let _ = crate::email::send_email(m).await;
|
let future = crate::email::send_email(m);
|
||||||
|
actix_rt::spawn(future);
|
||||||
} else {
|
} else {
|
||||||
error!("Email incorrect");
|
error!("Email incorrect");
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,10 +17,13 @@ pub async fn send_email(message: Message) -> Result<()> {
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
match sender.send(&message) {
|
match sender.send(&message) {
|
||||||
Ok(res) => info!(
|
Ok(res) => {
|
||||||
|
let res: String = res.message().collect();
|
||||||
|
info!(
|
||||||
"Successfully sent email to server with this response: {:?}",
|
"Successfully sent email to server with this response: {:?}",
|
||||||
res
|
res
|
||||||
),
|
)
|
||||||
|
}
|
||||||
Err(e) => error!("There was an error sending the email: {e}"),
|
Err(e) => error!("There was an error sending the email: {e}"),
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
Loading…
Reference in a new issue