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; mod templates;
use anyhow::Result; use anyhow::Result;
use axum::routing::{get, post}; use axum::routing::get;
use axum::{Router, Server}; use axum::{Router, Server};
use axum_extra::routing::SpaRouter; use axum_extra::routing::SpaRouter;
use std::net::{IpAddr, Ipv4Addr, SocketAddr}; use std::net::{IpAddr, Ipv4Addr, SocketAddr};
@ -42,9 +42,7 @@ async fn init() -> Result<()> {
}; };
let routes = Router::new() let routes = Router::new()
.route("/", get(routes::index)) .route("/", get(routes::index).post(routes::submit))
.route("/", post(routes::submit))
.route("/success", get(routes::success))
.with_state(app_state); .with_state(app_state);
let spa = SpaRouter::new(&format!("{}/static", &path_prefix), "static"); 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(config).await
success(State(config)).await
} }
pub async fn success( pub async fn success(config: Arc<config::Config>) -> Result<Response, errors::AppError> {
State(config): State<Arc<config::Config>>, info!("Successful contact form submission");
) -> Result<Response, errors::AppError> {
let template = templates::Success { let template = templates::Success {
path_prefix: &config.path_prefix, path_prefix: &config.path_prefix,
message: &config.strings.success, message: &config.strings.success,