Search code examples
pinia

How to mark pinia action private


I have a pinia store action ("the Master Action") that mutates the store's state. This action is somewhat complicated, so i've broken it down into smaller "Child Actions" each of which mutates a small part of the store's state.

Question: How do I mark these Child Actions as private so that when the store is used in a component only the Master Action is available to be called?

Thanks


Solution

  • Full answer here.

    TL;DR - You can write your "Child Actions" outside of the defineStore (in the same file or in a different file), and pass this as an argument.