Why am I getting a 422 error code? Why am I getting a 422 error code? vue.js vue.js

Why am I getting a 422 error code?


Laravel allows you to define certain validations on fields it accepts. If you fail these validations, it will return HTTP 422 - Unprocessable Entity. In your particular case, it appears that you're failing your own validation tests with an empty skeleton object, since companyName is required, and an empty string does not pass the required validation.

Assuming the other fields are similarly validated, a populated data object should solve your issue.

data: {  form: {    companyName: 'Dummy Company',    street: '123 Example Street',    city: 'Example',    state: 'CA',    zip: '90210',    contactName: 'John Smith',    phone: '310-555-0149',    email: 'john@example.com',    numberOfOffices: 1,    numberOfEmployees: 2,  }}