edit
Update the session's attributes.
This method creates a patch to apply changes to the session's attributes.
Note that attribute names are case-insensitive, meaning that referralCode and referralcode are treated as the same attribute and will override each other.
Best practice
Use descriptive camel case names like plan, userCase, and referralCode for custom attributes to improve readability and consistency with standard attributes.
Example
Here is a basic example of how to use this method:
const patch = croct.session.edit();const promise = patch.set('plan', 'starter').save();promise.then(() => console.log('Session updated successfully'));
Signature
This method has the following signature:
session.edit(): Patch
The return is a Patch for specifying the sequence of operations to apply to the session's attributes. Calling save on the patch returns a promise that resolves to the sessionAttributesChanged event after successful transmission.