victorybiz / vue-simple-acl

A simple unopinionated Vue plugin for managing user roles and permissions, access-control list (ACL) and role-based access control (RBAC).
https://github.com/victorybiz/vue-simple-acl
131 stars 24 forks source link

How to use pinia store ? #5

Closed rashidpathiyil closed 2 years ago

rashidpathiyil commented 2 years ago

ACL running before pinia store.

ahmmismailg commented 10 months ago

Why is this closed? this issue still exists. How to use store in src/acl/index.js ??

victorybiz commented 10 months ago

Why is this closed? this issue still exists. How to use store in src/acl/index.js ??

Pinia is supported. Read through the README, you can basically use Pinia or Vuex same way, replace the value of "user" option with the user object from your Pinia store.

JaxxC commented 8 months ago

Pinia is supported, but do not work as described, there are race condition in createApp, and acl almost always lose it, causing error "pinia not defined". So if you need to use it, make next workaround: create e.g "store/index.ts" file with next content: import { createPinia, setActivePinia } from "pinia"; const pinia = createPinia(); setActivePinia(pinia); export default pinia; Then in your main.js file use "import pinia from "./store";" instead "import { createPinia } from "pinia"; const pinia = createPinia();"