better scoping and such

main
Zynh0722 2023-11-06 11:15:51 -08:00
parent cecd4e0104
commit b6a0df5841
1 changed files with 10 additions and 8 deletions

View File

@ -16,15 +16,17 @@ async fn home() -> impl IntoResponse {
} }
async fn dancers(State(state): State<AppState>) -> impl IntoResponse { async fn dancers(State(state): State<AppState>) -> impl IntoResponse {
use cm_lib::schema::dancers::dsl::*; let dancers = {
use cm_lib::schema::dancers::dsl::*;
let mut conn = state.connection.get().await.unwrap(); let mut conn = state.connection.get().await.unwrap();
let dancers_vec = dancers dancers
.select(Dancer::as_select()) .select(Dancer::as_select())
.load(&mut conn) .load(&mut conn)
.await .await
.unwrap(); .unwrap()
};
render!(crate::templates::dancers_html, dancers_vec) render!(crate::templates::dancers_html, dancers)
} }