check item exists in object

This commit is contained in:
2023-06-12 11:45:33 +10:00
parent ca29189f9e
commit e07e2d2e2c

View File

@@ -84,7 +84,7 @@ const defaultFormObject: FormObject = {
if ( if (
apiResponse.data && apiResponse.data &&
typeof apiResponse.data === "object" && typeof apiResponse.data === "object" &&
apiResponse.data.errors "errors" in apiResponse.data
) { ) {
const errors = apiResponse.data.errors as Record<string, string>; const errors = apiResponse.data.errors as Record<string, string>;
Object.keys(errors).forEach((key) => { Object.keys(errors).forEach((key) => {
@@ -116,7 +116,6 @@ const defaultFormObject: FormObject = {
/** /**
* Create a new Form object. * Create a new Form object.
*
* @param {Record<string, FormControlObject>} controls The controls included in the form. * @param {Record<string, FormControlObject>} controls The controls included in the form.
* @returns {FormObject} Returns a form object. * @returns {FormObject} Returns a form object.
*/ */
@@ -177,7 +176,6 @@ export interface FormControlObject {
/** /**
* Create a new form control object. * Create a new form control object.
*
* @param {string} value The control name. * @param {string} value The control name.
* @param {ValidationObject | null} validator The control validation rules. * @param {ValidationObject | null} validator The control validation rules.
* @returns {FormControlObject} The form control object. * @returns {FormControlObject} The form control object.