fix(striker-ui): simplify field name in formik errors

main
Tsu-ba-me 11 months ago
parent d6ebd523c8
commit 59e692bcbe
  1. 12
      striker-ui/lib/getFormikErrorMessages.ts

@ -1,7 +1,17 @@
import { capitalize } from 'lodash';
const getFormikErrorMessages = ( const getFormikErrorMessages = (
errors: object, errors: object,
{ {
build = (field, error) => ({ children: error, type: 'warning' }), build = (field, error) => {
let children = error;
if (typeof children === 'string') {
children = capitalize(children.replace(/^[^\s]+\.([^.]+)/, '$1'));
}
return { children, type: 'warning' };
},
chain = '', chain = '',
skip, skip,
}: { }: {

Loading…
Cancel
Save