Skip to content

Commit

Permalink
feat: add dummy newsletter form
Browse files Browse the repository at this point in the history
  • Loading branch information
migueloller committed Feb 11, 2024
1 parent 4a76c32 commit 170747c
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/routes/admin/dashboard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ pub async fn admin_dashboard(
<p>Welcome {username}</p>
<p>Available actions:</p>
<ol>
<li><a href="/admin/newsletters">Send a newsletter issue</a></li>
<li><a href="/admin/password">Change password</a></li>
<li>
<form nam="logoutForm" action="/admin/logout" method="post">
Expand Down
2 changes: 2 additions & 0 deletions src/routes/admin/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
mod dashboard;
mod logout;
mod newsletters;
mod password;

pub use dashboard::admin_dashboard;
pub use logout::log_out;
pub use newsletters::*;
pub use password::*;
5 changes: 5 additions & 0 deletions src/routes/admin/newsletters/get.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
use actix_web::HttpResponse;

pub async fn submit_newsletter_form() -> HttpResponse {
HttpResponse::Ok().finish()
}
3 changes: 3 additions & 0 deletions src/routes/admin/newsletters/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
mod get;

pub use get::*;
3 changes: 2 additions & 1 deletion src/startup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate::{
email_client::EmailClient,
routes::{
admin_dashboard, change_password, change_password_form, confirm, health_check, home,
log_out, login, login_form, publish_newsletter, subscribe,
log_out, login, login_form, publish_newsletter, submit_newsletter_form, subscribe,
},
};
use actix_session::storage::RedisSessionStore;
Expand Down Expand Up @@ -108,6 +108,7 @@ async fn run(
web::scope("/admin")
.wrap(from_fn(reject_anonymous_users))
.route("/dashboard", web::get().to(admin_dashboard))
.route("/newsletters", web::get().to(submit_newsletter_form))
.route("/password", web::get().to(change_password_form))
.route("/password", web::post().to(change_password))
.route("/logout", web::post().to(log_out)),
Expand Down

0 comments on commit 170747c

Please sign in to comment.