Skip to content

Commit

Permalink
Merge branch 'bose/2660' into staging
Browse files Browse the repository at this point in the history
  • Loading branch information
BorghildSelle committed Nov 21, 2024
2 parents 4a7bc30 + 14a973a commit 1aef1c5
Showing 1 changed file with 22 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ const CareersContactForm = () => {
candidateType: '',
supportingDocuments: '',
},
mode: 'onBlur',
reValidateMode: 'onBlur',
})

const watchCategory = useWatch({
Expand All @@ -67,21 +69,21 @@ const CareersContactForm = () => {

const onSubmit = async (data: FormValues, event?: BaseSyntheticEvent) => {
data.preferredLang = intl.locale
/* if (isFriendlyChallengeDone) { */
const res = await fetch('/api/forms/service-now-careers-contact', {
body: JSON.stringify({
data,
frcCaptchaSolution: (event?.target as any)['frc-captcha-solution'].value,
catalogType: getCatalogType(intl, data.category, data.candidateType),
}),
headers: {
'Content-Type': 'application/json',
},
method: 'POST',
})
setSuccessfullySubmitted(res.status == 200)
setServerError(res.status != 200)
/* } else {
if (isFriendlyChallengeDone) {
const res = await fetch('/api/forms/service-now-careers-contact', {
body: JSON.stringify({
data,
frcCaptchaSolution: (event?.target as any)['frc-captcha-solution'].value,
catalogType: getCatalogType(intl, data.category, data.candidateType),
}),
headers: {
'Content-Type': 'application/json',
},
method: 'POST',
})
setSuccessfullySubmitted(res.status == 200)
setServerError(res.status != 200)
} else {
//@ts-ignore: TODO: types
setError('root.notCompletedCaptcha', {
type: 'custom',
Expand All @@ -90,7 +92,7 @@ const CareersContactForm = () => {
defaultMessage: 'Anti-Robot verification is required',
}),
})
} */
}
}

return (
Expand Down Expand Up @@ -255,11 +257,14 @@ const CareersContactForm = () => {
rules={{
validate: {
require: (value) => {
if (!value && setPositionIdMandatory)
console.log('value', value)
if (!value && setPositionIdMandatory) {
console.log('not validated required field')
return intl.formatMessage({
id: 'careers_contact_form_positionId_validation',
defaultMessage: 'Please enter a position ID or name ',
})
}
return true
},
},
Expand Down

0 comments on commit 1aef1c5

Please sign in to comment.