edit

Learn how to update the session's attributes.

This method creates a patch to apply changes to the session’s attributes.

See the session reference for the list of restrictions that apply to session 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.