Skip to content

Commit

Permalink
Merge pull request #43 from SocialGouv/fix/validite-inputs
Browse files Browse the repository at this point in the history
fix(ressources): validité des inputs
  • Loading branch information
alebret authored Jan 16, 2023
2 parents 08e2703 + 9e76afd commit fc338c3
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/pages/ressources.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,14 @@ export default function Ressources() {
const [phoneNumberValue, setPhoneNumberValue] = useState("");

const handleValidEmail = (event) => {
setEmailValid(event.currentTarget.validity.valid)
setEmailValue(event.currentTarget.value)
const emailTarger = event.currentTarget
setEmailValid(emailTarger.validity.valid && emailTarger.value.length > 0)
setEmailValue(emailTarger.value)
}
const handleValidPhone = (event) => {
setPhoneNumberValid(event.currentTarget.validity.valid)
setPhoneNumberValue(event.currentTarget.value)
const phoneTarger = event.currentTarget
setPhoneNumberValid(phoneTarger.validity.valid && phoneTarger.value.length > 0)
setPhoneNumberValue(phoneTarger.value)
}

useEffect(() => {
Expand All @@ -89,7 +91,7 @@ export default function Ressources() {

const [sendEmailContactQuery] = useMutation(EPDS_CONTACT_INFORMATION, {
client: client,
onCompleted: (data) => {
onCompleted: () => {
setSendingMessage("La demande a été envoyée")
setLoading(false)
saveContactRequest()
Expand Down

0 comments on commit fc338c3

Please sign in to comment.