Epps!

User Store

This page is an example of how to create a store representing a user. The store called useUserStore and uses deep inheritance to benefit from the state and methods of several parent stores.

User Store creation

This store inherits from the useContactStore, which in turn inherits from the useItemStore.

In addition, the Store extends the setData method also declared in the parent Store useItemStore.

The store is also persisted every time its state is modified, thanks to the persist.watchMutation option, and sensitive data is encrypted thanks to the persist.persistedPropertiesToEncrypt option (see localStorage "connectedUser" key).

@see

For more information on parent stores extended by useUserStore : Github repo

Use User Store

We create an instance of the user store using useUserStore and type it with the appropriate methods and state.

Set data

Use setData method to set or update user data.