@@ -36,6 +36,7 @@ const profileSchema = z.object({
3636 password : z . string ( ) . nullable ( ) ,
3737 currentPassword : z . string ( ) . nullable ( ) ,
3838 image : z . string ( ) . optional ( ) ,
39+ name : z . string ( ) . optional ( ) ,
3940 allowImpersonation : z . boolean ( ) . optional ( ) . default ( false ) ,
4041} ) ;
4142
@@ -84,6 +85,7 @@ export const ProfileForm = () => {
8485 image : data ?. user ?. image || "" ,
8586 currentPassword : "" ,
8687 allowImpersonation : data ?. user ?. allowImpersonation || false ,
88+ name : data ?. user ?. name || "" ,
8789 } ,
8890 resolver : zodResolver ( profileSchema ) ,
8991 } ) ;
@@ -97,6 +99,7 @@ export const ProfileForm = () => {
9799 image : data ?. user ?. image || "" ,
98100 currentPassword : form . getValues ( "currentPassword" ) || "" ,
99101 allowImpersonation : data ?. user ?. allowImpersonation ,
102+ name : data ?. user ?. name || "" ,
100103 } ,
101104 {
102105 keepValues : true ,
@@ -119,6 +122,7 @@ export const ProfileForm = () => {
119122 image : values . image ,
120123 currentPassword : values . currentPassword || undefined ,
121124 allowImpersonation : values . allowImpersonation ,
125+ name : values . name || undefined ,
122126 } )
123127 . then ( async ( ) => {
124128 await refetch ( ) ;
@@ -128,6 +132,7 @@ export const ProfileForm = () => {
128132 password : "" ,
129133 image : values . image ,
130134 currentPassword : "" ,
135+ name : values . name || "" ,
131136 } ) ;
132137 } )
133138 . catch ( ( ) => {
@@ -167,6 +172,19 @@ export const ProfileForm = () => {
167172 className = "grid gap-4"
168173 >
169174 < div className = "space-y-4" >
175+ < FormField
176+ control = { form . control }
177+ name = "name"
178+ render = { ( { field } ) => (
179+ < FormItem >
180+ < FormLabel > Name</ FormLabel >
181+ < FormControl >
182+ < Input placeholder = "Name" { ...field } />
183+ </ FormControl >
184+ < FormMessage />
185+ </ FormItem >
186+ ) }
187+ />
170188 < FormField
171189 control = { form . control }
172190 name = "email"
0 commit comments