Changes
This commit is contained in:
+14
-4
@@ -419,7 +419,12 @@
|
||||
}).then(postContact);
|
||||
});
|
||||
} else {
|
||||
postContact('');
|
||||
// Captcha unavailable: show clear error and restore UI
|
||||
submitMSG(false, t('form.captchaFailed'));
|
||||
formError();
|
||||
loader.hide();
|
||||
button.prop('disabled', false);
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -460,20 +465,24 @@
|
||||
}).then(postCv);
|
||||
});
|
||||
} else {
|
||||
postCv('');
|
||||
// Captcha unavailable: show clear error and restore UI
|
||||
$msg.removeClass().addClass('form-message text-danger').text(t('form.captchaFailed'));
|
||||
$button.prop('disabled', false).text(t('cv.submit'));
|
||||
return;
|
||||
}
|
||||
function postCv(token) {
|
||||
try {
|
||||
var formData = new FormData();
|
||||
formData.append('cv', file);
|
||||
formData.append('gdprConsent', String(consent));
|
||||
formData.append('captchaToken', token || '');
|
||||
var cvResponse = await fetch('/api/cv-matcher/upload', {
|
||||
method: 'POST',
|
||||
body: formData
|
||||
});
|
||||
if (!cvResponse.ok) throw new Error(t('cv.cvFailed'));
|
||||
var cvData = await cvResponse.json();
|
||||
var matchResponse = await fetch('/api/cv-matcher/match-job', {
|
||||
var matchResponse = await fetch('/api/cv-matcher/match-job', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
@@ -482,7 +491,8 @@
|
||||
cvDocumentId: cvData.documentId || cvData.cvDocumentId,
|
||||
jobUrl: jobUrl,
|
||||
jobDescription: jobDescription,
|
||||
gdprConsent: consent
|
||||
gdprConsent: consent,
|
||||
captchaToken: token
|
||||
})
|
||||
});
|
||||
if (!matchResponse.ok) throw new Error(t('cv.matchFailed'));
|
||||
|
||||
Reference in New Issue
Block a user