N
Nuxtβ€’2mo ago
Neamix

Cant access pinia from component

I am trying to access my store from component but i am getting that error
[🍍]: "getActivePinia()" was called but there was no active Pinia. Are you trying to use a store before calling "app.use(pinia)"? See https://pinia.vuejs.org/core-concepts/outside-component-usage.html for help. This will fail in production.
[🍍]: "getActivePinia()" was called but there was no active Pinia. Are you trying to use a store before calling "app.use(pinia)"? See https://pinia.vuejs.org/core-concepts/outside-component-usage.html for help. This will fail in production.
if i called my store from page it work but if i called it from store it not here is my component code
<template>
<div class="dropdown w-full m-auto rounded-[16px] overflow-hidden register-card absolute bg-white left-0 top-14 border border-gray-200 ">
<slot name="items"></slot>
</div>
</template>

<script>
// import { useRegisterStore } from '@/stores/register';

let registerStore = useRegisterStore();
</script>
<template>
<div class="dropdown w-full m-auto rounded-[16px] overflow-hidden register-card absolute bg-white left-0 top-14 border border-gray-200 ">
<slot name="items"></slot>
</div>
</template>

<script>
// import { useRegisterStore } from '@/stores/register';

let registerStore = useRegisterStore();
</script>
1 Reply
Neamix
NeamixOPβ€’2mo ago
it was a silly mistake i foret to add setup on script so nuxt rendered it before pinia
Want results from more Discord servers?
Add your server