// rocie - An enterprise grocery management system - Web app // // Copyright (C) 2026 Benedikt Peetz // SPDX-License-Identifier: GPL-3.0-or-later // // This file is part of Rocie. // // You should have received a copy of the License along with this program. // If not, see . use leptos::{IntoView, component, view}; use rocie_client::models::{Unit, UnitProperty}; use crate::{ api::{unit_properties_wrapped, units_wrapped}, components::{async_fetch::AsyncFetch, container::Container, icon_p::IconP}, }; #[component] pub fn UnitOverview() -> impl IntoView { view! { }, "units"), ( view! { }, "create-unit", ), ( view! { }, "create-unit-property", ), ] > { AsyncFetch! { @map_error_in_producer fetcher = get_units_and_unit_properties(), producer = |(units, unit_properties)| { view! {

{move || format!( "You have {} units and {} unit properties.", units.len(), unit_properties.len() )}

} }, } }
} } async fn get_units_and_unit_properties() -> Result<(Vec, Vec), leptos::error::Error> { Ok((units_wrapped().await?, unit_properties_wrapped().await?)) }