Remove unneeded routes

This commit is contained in:
Mo 2022-12-03 17:50:22 +01:00
parent 02f0a7cbb7
commit 2c571ae3b4
2 changed files with 6 additions and 9 deletions

View file

@ -9,7 +9,7 @@ mod states;
mod templates;
use anyhow::Result;
use axum::routing::{get, post};
use axum::routing::get;
use axum::{Router, Server};
use axum_extra::routing::SpaRouter;
use std::net::{IpAddr, Ipv4Addr, SocketAddr};
@ -42,9 +42,7 @@ async fn init() -> Result<()> {
};
let routes = Router::new()
.route("/", get(routes::index))
.route("/", post(routes::submit))
.route("/success", get(routes::success))
.route("/", get(routes::index).post(routes::submit))
.with_state(app_state);
let spa = SpaRouter::new(&format!("{}/static", &path_prefix), "static");

View file

@ -117,13 +117,12 @@ pub async fn submit(
}
}
info!("Successful contact form submission");
success(State(config)).await
success(config).await
}
pub async fn success(
State(config): State<Arc<config::Config>>,
) -> Result<Response, errors::AppError> {
pub async fn success(config: Arc<config::Config>) -> Result<Response, errors::AppError> {
info!("Successful contact form submission");
let template = templates::Success {
path_prefix: &config.path_prefix,
message: &config.strings.success,