fix: Eccezione durante la visualizzazione degli errori
Il trattamento degli errori restituiti dal server in AddEditRecordDialog.tsx è ora gestito attraverso un campo di messaggio piuttosto che unire tutti i dettagli dell'errore. Questo è stato modificato per risolvere i problemi di leggibilità con errori multipli. Come soluzione temporanea, la struttura dell'interfaccia "RequestError" in request.d.ts è stata modificata per includere sia la lista degli errori che il messaggio di errore.
This commit is contained in:
parent
30fc79d7af
commit
2c6dec2647
|
@ -146,7 +146,7 @@ export default abstract class AddEditRecordDialog<M extends Model<any, any>> ext
|
|||
}
|
||||
|
||||
onSaveError(error: JSONAPI.RequestError): void {
|
||||
const message = error.response.errors.map((error_) => error_.detail).join('; ');
|
||||
const message = error.response.data.message;
|
||||
void showSnackbar(message, false);
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,11 @@ export declare namespace JSONAPI {
|
|||
|
||||
export interface RequestError {
|
||||
response: {
|
||||
errors: JSONAPI.Error[]
|
||||
// TODO: This is a temporary fix, new model library will be implemented later
|
||||
data: {
|
||||
errors: JSONAPI.Error[],
|
||||
message: string
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue