refactor: add renderer middleware + base of roles and authorizations
This commit is contained in:
parent
40b892391a
commit
c277ab3bd9
30 changed files with 374 additions and 137 deletions
|
|
@ -1,17 +1,16 @@
|
|||
use axum::{extract::State, response::{Html, IntoResponse}};
|
||||
use axum::{response::IntoResponse, Extension};
|
||||
use axum_macros::debug_handler;
|
||||
use minijinja::context;
|
||||
|
||||
use crate::server::AppState;
|
||||
use crate::renderer::TemplateRenderer;
|
||||
|
||||
#[debug_handler]
|
||||
pub async fn home(
|
||||
State(app_state): State<AppState>
|
||||
Extension(renderer): Extension<TemplateRenderer>
|
||||
) -> impl IntoResponse {
|
||||
Html(
|
||||
app_state.templating_env.get_template("pages/home.html").unwrap()
|
||||
.render(context!())
|
||||
.unwrap()
|
||||
renderer.render(
|
||||
"pages/home",
|
||||
context!()
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue