fix: read error message from ApiError.message instead of err.response in konto mutation onError
This commit is contained in:
@@ -992,7 +992,7 @@ function KontenTab({ haushaltsjahre, selectedJahrId, onJahrChange }: {
|
|||||||
const createKontoMut = useMutation({
|
const createKontoMut = useMutation({
|
||||||
mutationFn: buchhaltungApi.createKonto,
|
mutationFn: buchhaltungApi.createKonto,
|
||||||
onSuccess: () => { qc.invalidateQueries({ queryKey: ['buchhaltung-konten'] }); qc.invalidateQueries({ queryKey: ['kontenTree'] }); setKontoDialog({ open: false }); showSuccess('Konto erstellt'); },
|
onSuccess: () => { qc.invalidateQueries({ queryKey: ['buchhaltung-konten'] }); qc.invalidateQueries({ queryKey: ['kontenTree'] }); setKontoDialog({ open: false }); showSuccess('Konto erstellt'); },
|
||||||
onError: (err: any) => showError(err?.response?.data?.message || 'Konto konnte nicht erstellt werden'),
|
onError: (err: any) => showError(err?.message || err?.response?.data?.message || 'Konto konnte nicht erstellt werden'),
|
||||||
});
|
});
|
||||||
const updateKontoMut = useMutation({
|
const updateKontoMut = useMutation({
|
||||||
mutationFn: ({ id, data }: { id: number; data: Partial<KontoFormData> }) => buchhaltungApi.updateKonto(id, data),
|
mutationFn: ({ id, data }: { id: number; data: Partial<KontoFormData> }) => buchhaltungApi.updateKonto(id, data),
|
||||||
|
|||||||
Reference in New Issue
Block a user