@alexsab-ru/scripts 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.
- package/lib/form.js +6 -4
- package/package.json +1 -1
package/lib/form.js
CHANGED
|
@@ -119,7 +119,7 @@ const showMessageModal = (messageModal, icon, message) => {
|
|
|
119
119
|
messageModal.classList.remove("hidden");
|
|
120
120
|
};
|
|
121
121
|
|
|
122
|
-
export const connectForms = (url, callback, callback_error, ct_routeKey = '
|
|
122
|
+
export const connectForms = (url, callback, callback_error, ct_routeKey = '', verbose = false) => {
|
|
123
123
|
|
|
124
124
|
// Отправка всех форм
|
|
125
125
|
document.querySelectorAll("form").forEach((form) => {
|
|
@@ -187,9 +187,11 @@ document.querySelectorAll("form").forEach((form) => {
|
|
|
187
187
|
let formDataObj = {};
|
|
188
188
|
try {
|
|
189
189
|
// Отправка заявки на обратный возов в CallTouch
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
190
|
+
if(ct_routeKey != '') {
|
|
191
|
+
const requestData = await createRequest(ct_routeKey, phone.value, verbose);
|
|
192
|
+
formData.append("ct_callback", true);
|
|
193
|
+
formData.append("ctw_createRequest", JSON.stringify(requestData));
|
|
194
|
+
}
|
|
193
195
|
} catch (error) {
|
|
194
196
|
formData.append("ctw_createRequest", error);
|
|
195
197
|
verbose && console.error("Error during request Calltouch callback:", error);
|