Remove unneeded routes
This commit is contained in:
parent
02f0a7cbb7
commit
2c571ae3b4
2 changed files with 6 additions and 9 deletions
|
@ -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");
|
||||||
|
|
|
@ -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,
|
||||||
|
|
Loading…
Reference in a new issue