new features
This commit is contained in:
@@ -100,7 +100,7 @@ export default function BestellungDetail() {
|
||||
const [deleteReminderTarget, setDeleteReminderTarget] = useState<number | null>(null);
|
||||
|
||||
// ── Query ──
|
||||
const { data, isLoading, isError } = useQuery({
|
||||
const { data, isLoading, isError, error, refetch } = useQuery({
|
||||
queryKey: ['bestellung', orderId],
|
||||
queryFn: () => bestellungApi.getOrder(orderId),
|
||||
enabled: !!orderId,
|
||||
@@ -263,11 +263,17 @@ export default function BestellungDetail() {
|
||||
}
|
||||
|
||||
if (isError || !bestellung) {
|
||||
const is404 = (error as any)?.response?.status === 404 || !bestellung;
|
||||
return (
|
||||
<DashboardLayout>
|
||||
<Box sx={{ p: 4, textAlign: 'center' }}>
|
||||
<Typography color="error">Bestellung nicht gefunden.</Typography>
|
||||
<Button sx={{ mt: 2 }} onClick={() => navigate('/bestellungen')}>Zurück</Button>
|
||||
<Typography color="error">
|
||||
{is404 ? 'Bestellung nicht gefunden.' : 'Fehler beim Laden der Bestellung.'}
|
||||
</Typography>
|
||||
{!is404 && (
|
||||
<Button sx={{ mt: 2 }} variant="outlined" onClick={() => refetch()}>Erneut versuchen</Button>
|
||||
)}
|
||||
<Button sx={{ mt: 2, ml: !is404 ? 1 : 0 }} onClick={() => navigate('/bestellungen')}>Zurück</Button>
|
||||
</Box>
|
||||
</DashboardLayout>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user