fix: return 409 on duplicate kontonummer, show server error in snackbar, block save when sub-account suffix is empty
This commit is contained in:
@@ -268,7 +268,7 @@ function KontoDialog({
|
||||
</DialogContent>
|
||||
<DialogActions>
|
||||
<Button onClick={onClose}>Abbrechen</Button>
|
||||
<Button variant="contained" onClick={() => onSave(form)}>Speichern</Button>
|
||||
<Button variant="contained" onClick={() => onSave(form)} disabled={!form.bezeichnung || !form.kontonummer || (!!parentPrefix && kontonummerSuffix === '')}>Speichern</Button>
|
||||
</DialogActions>
|
||||
</Dialog>
|
||||
);
|
||||
@@ -992,7 +992,7 @@ function KontenTab({ haushaltsjahre, selectedJahrId, onJahrChange }: {
|
||||
const createKontoMut = useMutation({
|
||||
mutationFn: buchhaltungApi.createKonto,
|
||||
onSuccess: () => { qc.invalidateQueries({ queryKey: ['buchhaltung-konten'] }); qc.invalidateQueries({ queryKey: ['kontenTree'] }); setKontoDialog({ open: false }); showSuccess('Konto erstellt'); },
|
||||
onError: () => showError('Konto konnte nicht erstellt werden'),
|
||||
onError: (err: any) => showError(err?.response?.data?.message || 'Konto konnte nicht erstellt werden'),
|
||||
});
|
||||
const updateKontoMut = useMutation({
|
||||
mutationFn: ({ id, data }: { id: number; data: Partial<KontoFormData> }) => buchhaltungApi.updateKonto(id, data),
|
||||
|
||||
Reference in New Issue
Block a user