Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

rafa-acioly's avatar

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')

0 likes
0 replies

Please or to participate in this conversation.