Save to local storage action

With the Save to Local Storage action, you can save values in the browser's local storage. This is useful when you want to share the same value between multiple pages, like user token or user preferences. The saved value is available as {{localStorage.<key>}} in all actions and components.

First, specify a variable's name. This name will be used to access the value in the Local Storage.

Then, use the Value field to pass the data you want to save.

Saving a result of the previous step

{{data.token}}

You can always adjust the data before saving it.

Add additional values

const values = {{ui.form.value}};

return {
  ...values,
  created_at: new Date(),
}Jav

The created_at column must exist in the table schema, otherwise, it will not be sent.

Change the values

const values = {{ui.form.value}};
return {
  ...values,
  name: values.name.toUpperCase(),
}

Delete unwanted values

const values = {{ui.form.value}};
delete values.age;
return values;

alternatively:

const values = {{ui.form.value}};
const { created_at, ...rest } = values;
return rest;

Join array values

const values = {{ui.form.value}};
return {
  ...values,
  tags: values.tags.join(','),
}

Use default values

const values = {{ui.form.value}};
return {
  ...values,
  // if the value is not set, use the default value
  created_at: values.created_at || new Date(),
}

Last updated