diff --git a/src/pages/supply/NewListing.tsx b/src/pages/supply/NewListing.tsx index 8508a92..e9c3b91 100644 --- a/src/pages/supply/NewListing.tsx +++ b/src/pages/supply/NewListing.tsx @@ -1,5 +1,6 @@ import { useState } from 'react' import { useLocation, useNavigate } from 'react-router' +import { useQueryClient } from '@tanstack/react-query' import { Alert, Box, @@ -76,6 +77,7 @@ interface LocationState { export default function NewListing() { const navigate = useNavigate() + const qc = useQueryClient() const { state } = useLocation() as { state: LocationState | null } const pre = state?.prefill ?? {} @@ -219,6 +221,7 @@ export default function NewListing() { try { await propertyService.create(input) + qc.invalidateQueries({ queryKey: ['properties'] }) setCreated(true) } catch { setError('Fehler beim Erstellen des Inserats. Bitte erneut versuchen.')