'how to call actions from pinia store?

How I can call action from pinia store in vue 3 component? I use composition API. For example, I would like to import 'openLessonCard' - it is action in pinia store. But this method for import don't work..

<script setup>
import { openLessonCard } from '../../stores/lessonsN.js';
import { ref, computed } from 'vue'


defineProps({
  data: {
    type: Object,
    required: true,
  },
  nocollapse: {
  type: Boolean,
  },
});

const reviewLevel = computed(() => {
  return Object.values(this.data.criteria).filter((i) => i === true).length;
})

async function editReviews(id, text, a, b, c, d, e) {
  let review = await this.$api.call("reviews.edit", {
    id,
    text,
    a,
    b,
    c,
    d,
    e,
  });
  this.$Message("ok");
}


Solution 1:[1]

You need to create a store instance and call actions

 const store = useLessonsNStore()

 store. openLessonCard()

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 duynhanf