11<script setup>
2- import { useTemplateRef } from ' vue' ;
2+ import { useTemplateRef , nextTick } from ' vue' ;
33import { useToast } from ' primevue/usetoast' ;
44import { useAuthStore } from ' @/stores/auth' ;
55import { useAxiosForm } from ' @/composables/useAxiosForm' ;
@@ -38,14 +38,22 @@ const submit = () => {
3838 resetFormFields ();
3939 authStore .fetchUser ();
4040 },
41- onError : () => {
41+ onError: async () => {
42+ await nextTick ();
4243 if (validationErrors .value ? .password ) {
4344 resetFormFields (' password' , ' password_confirmation' );
44- newPasswordInput .value .$el .focus ();
45+ const newPasswordInputElement = newPasswordInput .value .$el .querySelector (' input' );
46+ if (newPasswordInputElement) {
47+ newPasswordInputElement .focus ();
48+ }
4549 }
4650 if (validationErrors .value ? .current_password ) {
4751 resetFormFields (' current_password' );
48- currentPasswordInput .value .$el .focus ();
52+ const currentPasswordInputElement = currentPasswordInput .value .$el .querySelector (' input' );
53+ console .log (currentPasswordInput .value .$el );
54+ if (currentPasswordInputElement) {
55+ currentPasswordInputElement .focus ();
56+ }
4957 }
5058 },
5159 });
@@ -72,13 +80,14 @@ const submit = () => {
7280 >
7381 < div class = " flex flex-col gap-2" >
7482 < label for = " current_password" > Current Password< / label>
75- < InputText
83+ < Password
7684 id= " current_password"
7785 ref= " current-password-input"
7886 v- model= " formData.current_password"
7987 : invalid= " Boolean(validationErrors?.current_password)"
80- type = " password "
88+ : feedback = " false "
8189 autocomplete= " current-password"
90+ toggleMask
8291 required
8392 fluid
8493 / >
@@ -102,12 +111,13 @@ const submit = () => {
102111
103112 < div class = " flex flex-col gap-2" >
104113 < label for = " password_confirmation" > Confirm Password< / label>
105- < InputText
114+ < Password
106115 id= " password_confirmation"
107116 v- model= " formData.password_confirmation"
108117 : invalid= " Boolean(validationErrors?.password_confirmation)"
109- type = " password "
118+ : feedback = " false "
110119 autocomplete= " confirm-password"
120+ toggleMask
111121 required
112122 fluid
113123 / >
0 commit comments