Set user language to new recipe + cleaning

This commit is contained in:
Greg Burri 2025-01-06 22:52:22 +01:00
parent 8b4b788562
commit 03ebbb74fa
12 changed files with 73 additions and 86 deletions

View file

@ -5,7 +5,6 @@ use axum::{
middleware::Next,
response::{IntoResponse, Response, Result},
};
// use tracing::{event, Level};
use crate::{
data::{db, model},
@ -54,7 +53,9 @@ pub async fn home_page(
Extension(tr): Extension<translation::Tr>,
) -> Result<impl IntoResponse> {
let recipes = Recipes {
published: connection.get_all_published_recipe_titles().await?,
published: connection
.get_all_published_recipe_titles(tr.current_lang_code(), user.as_ref().map(|u| u.id))
.await?,
unpublished: if let Some(user) = user.as_ref() {
connection
.get_all_unpublished_recipe_titles(user.id)