# Pinia Collection 🍍

This repository contains a collection of (Pinia) store modules and plugins

## Installation

1. Add Pinia to your project. [Follow the guide here](https://pinia.vuejs.org/getting-started.html)
2. Add the netvlies pinia collection to your project: `npm i @netvlies/pinia-collection;`
3. Create a compatible Pinia instance and provide custom options:

```
import { createApp } from 'vue';
import { usePiniaCollection } from '@netvlies/pinia-collection';

createApp({...}).use(usePiniaCollection({...}));
```

4. Import the module(s) you need inside your `script setup`: `import { useAuthStore } from '@netvlies/pinia-collection';`
5. Use the imported module in the composition API or anywhere after initialization of Pinia. [See the docs](https://pinia.vuejs.org/core-concepts/outside-component-usage.html).

## Usage of plugins without Pinia collection instance

By default, some of the plugins provided by this collection will be loaded on usage of `usePiniaCollection`. If you have a Pinia instance of your own and just want to use some of these plugins, insert the following:

```
import { createPinia } from 'pinia';
import { useAPI } from '@netvlies/pinia-collection;

const pinia = createPinia();

pinia.use({ store } => {
    store.$api = useAPI(...);
});
```

For more docs, follow the [Pinia plugin guide](https://pinia.vuejs.org/core-concepts/plugins.html)

## Contributing guide

1. Clone this repo
2. Make your changes and commit them according to our [git commit format](https://netvlies.jira.com/l/c/Z2MQzswC)
3. Submit PR and get it approved
4. Merge PR to `release/{MR Creation year}{MR creation month}{3 digit number}` e.g. `release/202206001`
5. Create new release with `npm run release`
6. Merge release to `main`
