Socket
Book a DemoInstallSign in
Socket

@ag04/react-utils

Package Overview
Dependencies
Maintainers
4
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ag04/react-utils

![npm version](https://img.shields.io/npm/v/@ag04/react-utils.svg?style=for-the-badge)

1.0.1
latest
Source
npmnpm
Version published
Weekly downloads
0
Maintainers
4
Weekly downloads
 
Created
Source

React utils

npm version

Documentation

parseFormErrors

Parses spring-form errors to redux-form error object.

VERSION 0.0.7

parseFormErrors(errors: FormFieldError[]): ParsedFormErrors

interface FormFieldError { defaultMessage: string, field: string }

type ParsedFormErrors = { ​[fieldName: string]: string }

👉 example
    api.post("/foo", fooFormData)
            .then(res => res.data)
            .catch(e => { 
                    // map spring form error arrray to redux-form error object
                   const errors = parseFormErrors(e.response.data.errors);
                   
                   // show field errors in form
                   dispatch(reduxForm.stopSubmit(errors));
             });

VERSION 1.0.0

parseFormErrors now expects object to have property "message" instead of "defaultMessage"

FAQs

Package last updated on 14 Feb 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.