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": {
"start": "webpack serve",
"build": "webpack --mode production",
"build-dev": "webpack --mode development",
"lint": "eslint src",
"extract": "formatjs extract",
"compile": "formatjs compile"

View File

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

View File

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