diff --git a/frontend/src/pages/ShoppingPage.tsx b/frontend/src/pages/ShoppingPage.tsx index 4d5d50e..2717ddb 100644 --- a/frontend/src/pages/ShoppingPage.tsx +++ b/frontend/src/pages/ShoppingPage.tsx @@ -73,7 +73,7 @@ function mergeItems(groups: { recipe_title: string; recipe_id?: string; items: S export function ShoppingPage() { const qc = useQueryClient() - const { isAuthenticated } = useAuth() + const { isAuthenticated, isLoading: authLoading } = useAuth() const [newItem, setNewItem] = useState('') const [scope, setScope] = useState<'personal' | 'household'>('personal') const [viewMode, setViewMode] = useState<'recipe' | 'merged'>('merged') @@ -97,9 +97,10 @@ export function ShoppingPage() { const activeScope = hasHousehold ? scope : undefined - const { data: groups = [], isLoading, refetch } = useQuery({ + const { data: groups = [], isLoading, refetch } = useQuery({ queryKey: ['shopping', activeScope], queryFn: () => fetchShopping(activeScope), + enabled: isAuthenticated, }) const mergedItems = useMemo(() => mergeItems(groups), [groups]) @@ -193,7 +194,29 @@ export function ShoppingPage() { } } - if (isLoading) { + if (!authLoading && !isAuthenticated) { + return ( +
+
+
🛒
+

Einkaufsliste

+

+ Melde dich an, um deine eigene Einkaufsliste zu nutzen und sie mit deinem Haushalt zu teilen. +

+
+ + Anmelden + + + Registrieren + +
+
+
+ ) + } + + if (isLoading || authLoading) { return (
{[1, 2, 3].map((i) => (