diff --git a/web/src/pages/Products.jsx b/web/src/pages/Products.jsx index 8a91c00..d2dfbed 100644 --- a/web/src/pages/Products.jsx +++ b/web/src/pages/Products.jsx @@ -46,10 +46,15 @@ export default function Products({ fixedType = null }) { // "" = alle, sonst "food"/"object": trennt Lebensmittel und Gegenstände. const [typ, setTyp] = useState(""); const [error, setError] = useState(null); + const [loading, setLoading] = useState(true); useEffect(() => { // Alle Produkte einmal laden; das Filtern erledigt die Tabelle clientseitig. - api.listProducts("", "").then(setProducts).catch((err) => setError(err.message)); + setLoading(true); + api.listProducts("", "") + .then(setProducts) + .catch((err) => setError(err.message)) + .finally(() => setLoading(false)); api.listCategories().then(setCategories).catch(() => {}); }, []); @@ -126,7 +131,9 @@ export default function Products({ fixedType = null }) {

{titel}

- {sichtbar.length} {fixedType ? titel : `Produkte${activeTyp ? (activeTyp === "food" ? " · Lebensmittel" : " · Gegenstände") : " im Katalog"}`} + {loading + ? "Wird geladen…" + : `${sichtbar.length} ${fixedType ? titel : `Produkte${activeTyp ? (activeTyp === "food" ? " · Lebensmittel" : " · Gegenstände") : " im Katalog"}`}`}
{isAdmin && ( @@ -146,7 +153,8 @@ export default function Products({ fixedType = null }) {
p.id} empty="Keine Produkte gefunden." /> + getRowKey={(p) => p.id} + empty={loading ? "Produkte werden geladen…" : "Keine Produkte gefunden."} />
);