@altear147 I encountered this behavior today when I tried to update the username for a user:
await getFusionAuthClient(tenantId).updateUser(userId, {
user: {
username,
},
});
To my surprise (but probably only the lack of knowledge), this set theusername
of the user as specified but also deleted the email
just as you described.
I was thinking, okay, let's move on and don't touch username and specify firstName
as the only key for the update:
await getFusionAuthClient(tenantId).updateUser(userId, {
user: {
firstName,
},
});
but then I received this error:
Which I also didn't expect, since I assumed the userId
uniquely identifies a user and I don't have to supply more fields to help FusionAuth identify it.
After supplying the exact same things as you did:
await getFusionAuthClient(tenantId).updateUser(userId, {
user: {
email: email as string,
firstName: firstName as string,
lastName: lastName as string,
mobilePhone: mobilePhone as string,
},
});
my user object is getting updated. To clarify, the email input is disabled on my form, and users can only enter first name, last name, and mobile phone.
You can find the complete code here: https://github.com/akoskm/saas/blob/main/app/routes/team_.%24userId.edit.tsx
Hope this helps.