@open-tender/utils 0.5.3 → 0.5.4
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.
|
@@ -71,35 +71,31 @@ const useOneTimePasscodeForm = (otpSent, loading, error, recaptchaKey, submit, c
|
|
|
71
71
|
const values = /[a-zA-Z]/g.test(identifier)
|
|
72
72
|
? { email: identifier }
|
|
73
73
|
: { phone: identifier };
|
|
74
|
-
if (
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
if (!token) {
|
|
79
|
-
setSubmitting(false);
|
|
80
|
-
setErrors({
|
|
81
|
-
form: 'Please complete the recaptcha before submitting'
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
else {
|
|
85
|
-
submit(Object.assign(Object.assign({}, values), { recaptcha_token: token }));
|
|
86
|
-
setSubmitting(true);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
catch (err) {
|
|
74
|
+
if (recaptchaKey) {
|
|
75
|
+
try {
|
|
76
|
+
const token = (_a = recaptchaRef.current) === null || _a === void 0 ? void 0 : _a.getValue();
|
|
77
|
+
if (!token) {
|
|
90
78
|
setSubmitting(false);
|
|
91
79
|
setErrors({
|
|
92
80
|
form: 'Please complete the recaptcha before submitting'
|
|
93
81
|
});
|
|
94
82
|
}
|
|
83
|
+
else {
|
|
84
|
+
otpSent
|
|
85
|
+
? submit({ one_time_passcode, recaptcha_token: token })
|
|
86
|
+
: submit(Object.assign(Object.assign({}, values), { recaptcha_token: token }));
|
|
87
|
+
setSubmitting(true);
|
|
88
|
+
}
|
|
95
89
|
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
90
|
+
catch (err) {
|
|
91
|
+
setSubmitting(false);
|
|
92
|
+
setErrors({
|
|
93
|
+
form: 'Please complete the recaptcha before submitting'
|
|
94
|
+
});
|
|
99
95
|
}
|
|
100
96
|
}
|
|
101
97
|
else {
|
|
102
|
-
submit({ one_time_passcode });
|
|
98
|
+
otpSent ? submit({ one_time_passcode }) : submit(values);
|
|
103
99
|
setSubmitting(true);
|
|
104
100
|
}
|
|
105
101
|
((_b = submitRef.current) === null || _b === void 0 ? void 0 : _b.blur) && ((_c = submitRef.current) === null || _c === void 0 ? void 0 : _c.blur());
|
|
@@ -68,35 +68,31 @@ export const useOneTimePasscodeForm = (otpSent, loading, error, recaptchaKey, su
|
|
|
68
68
|
const values = /[a-zA-Z]/g.test(identifier)
|
|
69
69
|
? { email: identifier }
|
|
70
70
|
: { phone: identifier };
|
|
71
|
-
if (
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
if (!token) {
|
|
76
|
-
setSubmitting(false);
|
|
77
|
-
setErrors({
|
|
78
|
-
form: 'Please complete the recaptcha before submitting'
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
else {
|
|
82
|
-
submit(Object.assign(Object.assign({}, values), { recaptcha_token: token }));
|
|
83
|
-
setSubmitting(true);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
catch (err) {
|
|
71
|
+
if (recaptchaKey) {
|
|
72
|
+
try {
|
|
73
|
+
const token = (_a = recaptchaRef.current) === null || _a === void 0 ? void 0 : _a.getValue();
|
|
74
|
+
if (!token) {
|
|
87
75
|
setSubmitting(false);
|
|
88
76
|
setErrors({
|
|
89
77
|
form: 'Please complete the recaptcha before submitting'
|
|
90
78
|
});
|
|
91
79
|
}
|
|
80
|
+
else {
|
|
81
|
+
otpSent
|
|
82
|
+
? submit({ one_time_passcode, recaptcha_token: token })
|
|
83
|
+
: submit(Object.assign(Object.assign({}, values), { recaptcha_token: token }));
|
|
84
|
+
setSubmitting(true);
|
|
85
|
+
}
|
|
92
86
|
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
87
|
+
catch (err) {
|
|
88
|
+
setSubmitting(false);
|
|
89
|
+
setErrors({
|
|
90
|
+
form: 'Please complete the recaptcha before submitting'
|
|
91
|
+
});
|
|
96
92
|
}
|
|
97
93
|
}
|
|
98
94
|
else {
|
|
99
|
-
submit({ one_time_passcode });
|
|
95
|
+
otpSent ? submit({ one_time_passcode }) : submit(values);
|
|
100
96
|
setSubmitting(true);
|
|
101
97
|
}
|
|
102
98
|
((_b = submitRef.current) === null || _b === void 0 ? void 0 : _b.blur) && ((_c = submitRef.current) === null || _c === void 0 ? void 0 : _c.blur());
|
package/package.json
CHANGED