How do I use multiple Pinia stores in Vue options api?

738 Views Asked by At

I have a couple of different Pinia stores but, I cant get the page to switch to a different store when the page loads.

This is what i tried:

mounted() {
    this.$pinia.use(useMachineService);
}

But when I switch to a different page the same store gets used.

1

There are 1 best solutions below

0
Melih Özcan On

Finally found the fricking problem. The problem was that I forget to give the defineStore a string parameter:

export const useUserService = defineStore('useUserService', {

It works if you don't use the string but then you wont be able to use multiple stores