refacto: rename html and rs templates dirs to old_*
This commit is contained in:
@ -1,34 +0,0 @@
|
||||
use askama_axum::Template;
|
||||
use axum::{
|
||||
async_trait,
|
||||
extract::FromRequestParts,
|
||||
http::{request::Parts, HeaderMap, StatusCode},
|
||||
};
|
||||
|
||||
#[derive(Template)]
|
||||
#[template(path = "pages/cps.html")]
|
||||
pub struct CpsTemplate;
|
||||
|
||||
pub struct ExtractHxRequest(bool);
|
||||
|
||||
#[async_trait]
|
||||
impl<S> FromRequestParts<S> for ExtractHxRequest
|
||||
where
|
||||
S: Send + Sync,
|
||||
{
|
||||
type Rejection = (StatusCode, &'static str);
|
||||
|
||||
async fn from_request_parts(parts: &mut Parts, _state: &S) -> Result<Self, Self::Rejection> {
|
||||
if parts.headers.get("HX-Request").is_some() {
|
||||
Ok(ExtractHxRequest(true))
|
||||
} else {
|
||||
Ok(ExtractHxRequest(false))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn cps(headers: HeaderMap, hx_request: ExtractHxRequest) -> CpsTemplate {
|
||||
println!("{:#?}", headers);
|
||||
println!("{:#?}", hx_request.0);
|
||||
CpsTemplate
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
use askama_axum::Template;
|
||||
|
||||
#[derive(Template)]
|
||||
#[template(path = "pages/home.html")]
|
||||
pub struct HomeTemplate;
|
||||
|
||||
pub async fn home() -> HomeTemplate {
|
||||
HomeTemplate
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
use axum::{routing, Router};
|
||||
|
||||
mod cps;
|
||||
mod home;
|
||||
|
||||
pub fn get_routes() -> Router {
|
||||
Router::new()
|
||||
.route("/home", routing::get(home::home))
|
||||
.route("/cps", routing::get(cps::cps))
|
||||
}
|
Reference in New Issue
Block a user