Socket
Socket
Sign inDemoInstall

@ag04/react-utils

Package Overview
Dependencies
0
Maintainers
4
Versions
9
Alerts
File Explorer

Advanced tools

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)


Version published
Weekly downloads
0
decreased by-100%
Maintainers
4
Install size
9.05 kB
Created
Weekly downloads
 

Readme

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

Last updated on 14 Feb 2019

Did you know?

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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc