1
1
<script setup>
2
- import { useTemplateRef } from ' vue' ;
2
+ import { useTemplateRef , nextTick } from ' vue' ;
3
3
import { useToast } from ' primevue/usetoast' ;
4
4
import { useAuthStore } from ' @/stores/auth' ;
5
5
import { useAxiosForm } from ' @/composables/useAxiosForm' ;
@@ -38,14 +38,22 @@ const submit = () => {
38
38
resetFormFields ();
39
39
authStore .fetchUser ();
40
40
},
41
- onError : () => {
41
+ onError: async () => {
42
+ await nextTick ();
42
43
if (validationErrors .value ? .password ) {
43
44
resetFormFields (' password' , ' password_confirmation' );
44
- newPasswordInput .value .$el .focus ();
45
+ const newPasswordInputElement = newPasswordInput .value .$el .querySelector (' input' );
46
+ if (newPasswordInputElement) {
47
+ newPasswordInputElement .focus ();
48
+ }
45
49
}
46
50
if (validationErrors .value ? .current_password ) {
47
51
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
+ }
49
57
}
50
58
},
51
59
});
@@ -72,13 +80,14 @@ const submit = () => {
72
80
>
73
81
< div class = " flex flex-col gap-2" >
74
82
< label for = " current_password" > Current Password< / label>
75
- < InputText
83
+ < Password
76
84
id= " current_password"
77
85
ref= " current-password-input"
78
86
v- model= " formData.current_password"
79
87
: invalid= " Boolean(validationErrors?.current_password)"
80
- type = " password "
88
+ : feedback = " false "
81
89
autocomplete= " current-password"
90
+ toggleMask
82
91
required
83
92
fluid
84
93
/ >
@@ -102,12 +111,13 @@ const submit = () => {
102
111
103
112
< div class = " flex flex-col gap-2" >
104
113
< label for = " password_confirmation" > Confirm Password< / label>
105
- < InputText
114
+ < Password
106
115
id= " password_confirmation"
107
116
v- model= " formData.password_confirmation"
108
117
: invalid= " Boolean(validationErrors?.password_confirmation)"
109
- type = " password "
118
+ : feedback = " false "
110
119
autocomplete= " confirm-password"
120
+ toggleMask
111
121
required
112
122
fluid
113
123
/ >
0 commit comments