Dec 17, 2023
0
Level 1
How to read errors from fortify update password?
How can I read the fortify error response using my useForm variable?
The form:
const form= useForm({
password: '',
current_password: '',
password_confirmation: '',
})
const updatePassword = () => {
form.put('/user/password', {
preserveScroll: true,
preserveState: true,
onSuccess: () => {
form.reset()
},
})
}
I cannot use form.errors.current_password because fortify error have this structure:
"props": {
"errors": {
"updatePassword": {
"current_password": "The provided password does not match your current password."
}
}
}
If I try to use form.errors.updatePassword.current_password I get the error
TypeError: Cannot read properties of undefined (reading 'current_password')
TypeError: Cannot read properties of null (reading 'emitsOptions')
Please or to participate in this conversation.