Fix error parsing bug on return

This commit is contained in:
Paulo Gustavo Veiga 2021-02-03 16:27:34 -08:00
parent 8df40788ba
commit eeceb9734a
3 changed files with 6 additions and 6 deletions

View File

@ -5,6 +5,7 @@
"scripts": { "scripts": {
"start": "webpack serve", "start": "webpack serve",
"build": "webpack --mode production", "build": "webpack --mode production",
"build-dev": "webpack --mode development",
"lint": "eslint src", "lint": "eslint src",
"extract": "formatjs extract", "extract": "formatjs extract",
"compile": "formatjs compile" "compile": "formatjs compile"

View File

@ -46,20 +46,18 @@ export const parseResponseOnError = (response: any): ErrorInfo => {
break; break;
default: default:
if (data) { if (data) {
result = {};
// Set global errors ... // Set global errors ...
if (data.globalErrors) { if (data.globalErrors) {
let msg; let msg:string;
let errors = data.globalErrors; let errors = data.globalErrors;
if (errors.length > 0) { if (errors.length > 0) {
msg = errors[0]; result.msg = errors[0];
} }
result = { msg: errors };
} }
// Set field errors ... // Set field errors ...
if (data.fieldErrors) { if (data.fieldErrors) {
// @Todo: Fix this ...
result = { msg: data.fieldErrors };
result.fields = new Map<string, string>(); result.fields = new Map<string, string>();
} }

View File

@ -5,7 +5,8 @@ import { Alert } from "@material-ui/lab";
export const StyledAlert = withStyles({ export const StyledAlert = withStyles({
root: root:
{ {
padding: '10px 0px 10px 0px' padding: '10px 15px',
margin: '5px 0px '
} }
})(Alert); })(Alert);