Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ressources): validité des inputs #43

Merged
merged 1 commit into from
Jan 16, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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