@open-tender/utils 0.1.34 → 0.1.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -29,7 +29,13 @@ const useProfileForm = (profile, loading, error, update
|
|
|
29
29
|
{ label: 'Phone', name: 'phone', type: 'tel', required: true },
|
|
30
30
|
{ label: 'Company', name: 'company', type: 'text' },
|
|
31
31
|
{ label: 'Birth Date (mm/dd/yyyy)', name: 'birth_date', type: 'tel' },
|
|
32
|
-
{
|
|
32
|
+
{
|
|
33
|
+
label: 'Gender',
|
|
34
|
+
name: 'gender',
|
|
35
|
+
type: 'select',
|
|
36
|
+
showLabel: true,
|
|
37
|
+
options: exports.genderOptions
|
|
38
|
+
}
|
|
33
39
|
];
|
|
34
40
|
(0, react_1.useEffect)(() => {
|
|
35
41
|
if (loading === 'idle') {
|
|
@@ -67,6 +73,7 @@ const useProfileForm = (profile, loading, error, update
|
|
|
67
73
|
evt.preventDefault();
|
|
68
74
|
if (!data)
|
|
69
75
|
return;
|
|
76
|
+
setErrors({});
|
|
70
77
|
setSubmitting(true);
|
|
71
78
|
// remove read-only properties
|
|
72
79
|
const rest = fields.reduce((obj, i) => (Object.assign(Object.assign({}, obj), { [i.name]: data[i.name] })), {});
|
|
@@ -59,7 +59,13 @@ const useSignUpForm = (loading, error, signUp, callback, checkConfig = {}, hasTh
|
|
|
59
59
|
required: companyRequired
|
|
60
60
|
},
|
|
61
61
|
{ label: 'Birth Date (mm/dd/yyyy)', name: 'birth_date', type: 'tel' },
|
|
62
|
-
{
|
|
62
|
+
{
|
|
63
|
+
label: 'Gender',
|
|
64
|
+
name: 'gender',
|
|
65
|
+
type: 'select',
|
|
66
|
+
showLabel: true,
|
|
67
|
+
options: useProfileForm_1.genderOptions
|
|
68
|
+
}
|
|
63
69
|
];
|
|
64
70
|
const fields = allFields.filter(i => !toRemove.includes(i.name));
|
|
65
71
|
(0, react_1.useEffect)(() => {
|
|
@@ -74,6 +80,9 @@ const useSignUpForm = (loading, error, signUp, callback, checkConfig = {}, hasTh
|
|
|
74
80
|
if (error) {
|
|
75
81
|
setErrors((0, utils_1.makeFormErrors)(error));
|
|
76
82
|
}
|
|
83
|
+
else {
|
|
84
|
+
setErrors({});
|
|
85
|
+
}
|
|
77
86
|
}
|
|
78
87
|
}, [loading, error]);
|
|
79
88
|
const handleChange = (name, value) => {
|
|
@@ -26,7 +26,13 @@ export const useProfileForm = (profile, loading, error, update
|
|
|
26
26
|
{ label: 'Phone', name: 'phone', type: 'tel', required: true },
|
|
27
27
|
{ label: 'Company', name: 'company', type: 'text' },
|
|
28
28
|
{ label: 'Birth Date (mm/dd/yyyy)', name: 'birth_date', type: 'tel' },
|
|
29
|
-
{
|
|
29
|
+
{
|
|
30
|
+
label: 'Gender',
|
|
31
|
+
name: 'gender',
|
|
32
|
+
type: 'select',
|
|
33
|
+
showLabel: true,
|
|
34
|
+
options: genderOptions
|
|
35
|
+
}
|
|
30
36
|
];
|
|
31
37
|
useEffect(() => {
|
|
32
38
|
if (loading === 'idle') {
|
|
@@ -64,6 +70,7 @@ export const useProfileForm = (profile, loading, error, update
|
|
|
64
70
|
evt.preventDefault();
|
|
65
71
|
if (!data)
|
|
66
72
|
return;
|
|
73
|
+
setErrors({});
|
|
67
74
|
setSubmitting(true);
|
|
68
75
|
// remove read-only properties
|
|
69
76
|
const rest = fields.reduce((obj, i) => (Object.assign(Object.assign({}, obj), { [i.name]: data[i.name] })), {});
|
|
@@ -56,7 +56,13 @@ export const useSignUpForm = (loading, error, signUp, callback, checkConfig = {}
|
|
|
56
56
|
required: companyRequired
|
|
57
57
|
},
|
|
58
58
|
{ label: 'Birth Date (mm/dd/yyyy)', name: 'birth_date', type: 'tel' },
|
|
59
|
-
{
|
|
59
|
+
{
|
|
60
|
+
label: 'Gender',
|
|
61
|
+
name: 'gender',
|
|
62
|
+
type: 'select',
|
|
63
|
+
showLabel: true,
|
|
64
|
+
options: genderOptions
|
|
65
|
+
}
|
|
60
66
|
];
|
|
61
67
|
const fields = allFields.filter(i => !toRemove.includes(i.name));
|
|
62
68
|
useEffect(() => {
|
|
@@ -71,6 +77,9 @@ export const useSignUpForm = (loading, error, signUp, callback, checkConfig = {}
|
|
|
71
77
|
if (error) {
|
|
72
78
|
setErrors(makeFormErrors(error));
|
|
73
79
|
}
|
|
80
|
+
else {
|
|
81
|
+
setErrors({});
|
|
82
|
+
}
|
|
74
83
|
}
|
|
75
84
|
}, [loading, error]);
|
|
76
85
|
const handleChange = (name, value) => {
|
package/package.json
CHANGED