diff --git a/resources/js/components/ToastNotification.vue b/resources/js/components/ToastNotification.vue index 51daa6f..11e319b 100644 --- a/resources/js/components/ToastNotification.vue +++ b/resources/js/components/ToastNotification.vue @@ -44,6 +44,22 @@ watch( }, { deep: true, immediate: true }, ); + +// Watch Inertia page errors for validation failures +watch( + () => page.props.errors, + (errors: any) => { + const errorKeys = Object.keys(errors || {}); + + if (errorKeys.length > 0) { + addToast( + 'Failed: Please fix the errors to continue.', + 'error', + ); + } + }, + { deep: true }, +);