edit

Learn how to update the user's profile.

This method creates a patch to apply changes to the user's profile.

Signature

This method has the following signature:

user.edit(): Patch

The return is a Patch for specifying the sequence of operations to apply to the user's profile. Calling save on the patch returns a promise that resolves to the userProfileChanged event after successful transmission.

Example

Here is a basic example of how to use this method:

import croct from '@croct/plug';
const patch = croct.user.edit();
const promise = patch  .set('company', 'Croct')  .add('interests', 'JavaScript')  .add('custom.pets', 'crocodile')  .save();
promise.then(() => console.log('Profile updated successfully'));